From d97a8a91563925f512b0dd22ebc0030c489a4dd0 Mon Sep 17 00:00:00 2001 From: Erkan Date: Mon, 15 Oct 2012 09:33:38 -0700 Subject: [PATCH 0001/1055] Add new French translations Closes #246 --- app/res/values-fr/strings.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/res/values-fr/strings.xml b/app/res/values-fr/strings.xml index 9374dd80d..8395fbaef 100644 --- a/app/res/values-fr/strings.xml +++ b/app/res/values-fr/strings.xml @@ -39,6 +39,9 @@ Erreur lors du chargement du fichier Erreur lors du chargement du code Erreur lors du chargement des branches et tags + Erreur lors de l\'abonnement + Erreur lors du désabonnement + Erreur lors de la vérification d\'abonnement @@ -175,6 +178,8 @@ Abonnements Abonnés Abonnements + S\'abonner + Se désabonner Membres Fermeture du ticket… Réouverture du ticket… @@ -220,6 +225,8 @@ Activer la coupure Désactiver la coupure Code + Abonnement… + Désabonnement… repositories @@ -241,4 +248,5 @@ tous Partager - \ No newline at end of file + Voir mot de passe + From 89655a11d631e48774371be9c77e0eec241af6b9 Mon Sep 17 00:00:00 2001 From: Johannes Schleifenbaum Date: Mon, 15 Oct 2012 09:34:44 -0700 Subject: [PATCH 0002/1055] Add German translation for (un-)following Closes #249 --- app/res/values-de/strings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/res/values-de/strings.xml b/app/res/values-de/strings.xml index 64b03761f..c4a561200 100644 --- a/app/res/values-de/strings.xml +++ b/app/res/values-de/strings.xml @@ -39,6 +39,9 @@ Laden der Datei fehlgeschlagen Laden des Codes fehlgeschlagen Laden der Branches & Tags fehlgeschlagen + Folgen fehlgeschlagen + Entfolgen fehlgeschlagen + Prüfen des Folgestatus fehlgeschlagen @@ -172,6 +175,8 @@ Ich folge Meine Anhänger Ich folge + Folgen + Entfolgen Mitglieder Schließe Problem… Problem neu öffnen… @@ -217,6 +222,8 @@ Zeilenumbruch aktivieren Zeilenumbruch deaktivieren Code + Folgen… + Entfolgen… Repositories From 7541c669a8b1e67d31b83fb976307b80fd23b80b Mon Sep 17 00:00:00 2001 From: Ado Matejov Date: Mon, 15 Oct 2012 09:36:04 -0700 Subject: [PATCH 0003/1055] Update Slovak locale Closes #250 --- app/res/values-sk/strings.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/res/values-sk/strings.xml b/app/res/values-sk/strings.xml index 44344ee5c..c8fcc7397 100644 --- a/app/res/values-sk/strings.xml +++ b/app/res/values-sk/strings.xml @@ -39,6 +39,9 @@ Načítavanie súboru zlyhalo Načítavanie kódu zlyhalo Načítavanie vetiev & značiek zlyhalo + Následovanie zlyhalo + Prestávanie sledovania zlyhalo + Nepodarilo sa zistiť stav sledovania @@ -175,6 +178,8 @@ Sleduje Sledujúci Sledujem + Sledovať + Prestať sledovať Členovia Zatváram issue… Znovu otváram issue… @@ -220,6 +225,8 @@ Zapnúť zalamovanie riadkov Vypnúť zalamovanie riadkov Kód + Začínam sledovať… + Prestávam sledovať… Repozitáre @@ -240,5 +247,7 @@ Obľúbené Všetky + Zdieľať + Ukázať heslo From 29f98f004ec957e3baed6462fd5b4bfc0bae8e9f Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Mon, 15 Oct 2012 09:38:54 -0700 Subject: [PATCH 0004/1055] Add ability to star/unstar repositories Closes #236 --- app/res/menu/repository_star.xml | 23 +++++ app/res/values/strings.xml | 7 ++ .../mobile/core/repo/StarRepositoryTask.java | 77 +++++++++++++++ .../core/repo/StarringRepositoryTask.java | 64 ++++++++++++ .../core/repo/UnstarRepositoryTask.java | 77 +++++++++++++++ .../ui/repo/RepositoryViewActivity.java | 98 +++++++++++++++++-- 6 files changed, 339 insertions(+), 7 deletions(-) create mode 100644 app/res/menu/repository_star.xml create mode 100644 app/src/main/java/com/github/mobile/core/repo/StarRepositoryTask.java create mode 100644 app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java create mode 100644 app/src/main/java/com/github/mobile/core/repo/UnstarRepositoryTask.java diff --git a/app/res/menu/repository_star.xml b/app/res/menu/repository_star.xml new file mode 100644 index 000000000..a7753713d --- /dev/null +++ b/app/res/menu/repository_star.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index aa45b3546..ff28b263d 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -42,6 +42,9 @@ Following failed Unfollowing failed Checking following status failed + Starring failed + Unstarring failed + Checking starring status failed @@ -180,6 +183,8 @@ Following Follow Unfollow + Star + Unstar Members Closing Issue… Reopening Issue… @@ -227,6 +232,8 @@ Code Following… Unfollowing… + Starring… + Unstarring… repositories diff --git a/app/src/main/java/com/github/mobile/core/repo/StarRepositoryTask.java b/app/src/main/java/com/github/mobile/core/repo/StarRepositoryTask.java new file mode 100644 index 000000000..3629bc123 --- /dev/null +++ b/app/src/main/java/com/github/mobile/core/repo/StarRepositoryTask.java @@ -0,0 +1,77 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.core.repo; + +import org.eclipse.egit.github.core.IRepositoryIdProvider; +import org.eclipse.egit.github.core.service.WatcherService; + +import android.accounts.Account; +import android.content.Context; +import android.util.Log; + +import com.github.mobile.R.string; +import com.github.mobile.ui.ProgressDialogTask; +import com.google.inject.Inject; + +/** + * Task to star a repository + */ +public class StarRepositoryTask extends ProgressDialogTask { + + private static final String TAG = "StarRepositoryTask"; + + @Inject + private WatcherService service; + + private final IRepositoryIdProvider repo; + + /** + * Create task for context and id provider + * + * @param context + * @param repo + */ + public StarRepositoryTask(Context context, IRepositoryIdProvider repo) { + super(context); + + this.repo = repo; + } + + /** + * Execute the task with a progress dialog displaying. + *

+ * This method must be called from the main thread. + */ + public void start() { + showIndeterminate(string.starring_repository); + + execute(); + } + + @Override + protected Void run(Account account) throws Exception { + service.watch(repo); + + return null; + } + + @Override + protected void onException(Exception e) throws RuntimeException { + super.onException(e); + + Log.d(TAG, "Exception starring repository", e); + } +} diff --git a/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java b/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java new file mode 100644 index 000000000..787043ca6 --- /dev/null +++ b/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java @@ -0,0 +1,64 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.core.repo; + +import org.eclipse.egit.github.core.IRepositoryIdProvider; +import org.eclipse.egit.github.core.service.WatcherService; + +import android.accounts.Account; +import android.content.Context; +import android.util.Log; + +import com.github.mobile.accounts.AuthenticatedUserTask; +import com.google.inject.Inject; + +/** + * Task to check repository starring status + */ +public class StarringRepositoryTask extends AuthenticatedUserTask { + + private static final String TAG = "StarringRepositoryTask"; + + @Inject + private WatcherService service; + + private final IRepositoryIdProvider repo; + + /** + * Create task for context and id provider + * + * @param context + * @param repo + */ + public StarringRepositoryTask(Context context, IRepositoryIdProvider repo) { + super(context); + + this.repo = repo; + } + + @Override + protected Boolean run(Account account) throws Exception { + + return service.isWatching(repo); + } + + @Override + protected void onException(Exception e) throws RuntimeException { + super.onException(e); + + Log.d(TAG, "Exception checking starring repository status", e); + } +} diff --git a/app/src/main/java/com/github/mobile/core/repo/UnstarRepositoryTask.java b/app/src/main/java/com/github/mobile/core/repo/UnstarRepositoryTask.java new file mode 100644 index 000000000..cd99f71aa --- /dev/null +++ b/app/src/main/java/com/github/mobile/core/repo/UnstarRepositoryTask.java @@ -0,0 +1,77 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.core.repo; + +import org.eclipse.egit.github.core.IRepositoryIdProvider; +import org.eclipse.egit.github.core.service.WatcherService; + +import android.accounts.Account; +import android.content.Context; +import android.util.Log; + +import com.github.mobile.R.string; +import com.github.mobile.ui.ProgressDialogTask; +import com.google.inject.Inject; + +/** + * Task to unstar a repository + */ +public class UnstarRepositoryTask extends ProgressDialogTask { + + private static final String TAG = "UnstarRepositoryTask"; + + @Inject + private WatcherService service; + + private final IRepositoryIdProvider repo; + + /** + * Create task for context and id provider + * + * @param context + * @param repo + */ + public UnstarRepositoryTask(Context context, IRepositoryIdProvider repo) { + super(context); + + this.repo = repo; + } + + /** + * Execute the task with a progress dialog displaying. + *

+ * This method must be called from the main thread. + */ + public void start() { + showIndeterminate(string.unstarring_repository); + + execute(); + } + + @Override + protected Void run(Account account) throws Exception { + service.unwatch(repo); + + return null; + } + + @Override + protected void onException(Exception e) throws RuntimeException { + super.onException(e); + + Log.d(TAG, "Exception unstarring repository", e); + } +} diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index df524d313..0c2cd9945 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -23,31 +23,36 @@ import static com.github.mobile.util.TypefaceUtils.ICON_COMMIT; import static com.github.mobile.util.TypefaceUtils.ICON_ISSUE_OPEN; import static com.github.mobile.util.TypefaceUtils.ICON_NEWS; + +import org.eclipse.egit.github.core.Repository; +import org.eclipse.egit.github.core.User; + +import roboguice.inject.InjectExtra; +import roboguice.inject.InjectView; import android.content.Intent; import android.os.Bundle; import android.widget.ProgressBar; import com.actionbarsherlock.app.ActionBar; +import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.Intents.Builder; import com.github.mobile.R.id; import com.github.mobile.R.layout; +import com.github.mobile.R.menu; import com.github.mobile.R.string; import com.github.mobile.core.repo.RefreshRepositoryTask; import com.github.mobile.core.repo.RepositoryUtils; +import com.github.mobile.core.repo.UnstarRepositoryTask; +import com.github.mobile.core.repo.StarRepositoryTask; +import com.github.mobile.core.repo.StarringRepositoryTask; import com.github.mobile.ui.TabPagerActivity; import com.github.mobile.ui.user.HomeActivity; import com.github.mobile.util.AvatarLoader; import com.github.mobile.util.ToastUtils; import com.google.inject.Inject; -import org.eclipse.egit.github.core.Repository; -import org.eclipse.egit.github.core.User; - -import roboguice.inject.InjectExtra; -import roboguice.inject.InjectView; - /** * Activity to view a repository */ @@ -73,6 +78,10 @@ public static Intent createIntent(Repository repository) { @InjectView(id.pb_loading) private ProgressBar loadingBar; + private boolean isStarring; + + private boolean starringStatusChecked; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -114,6 +123,23 @@ protected void onException(Exception e) throws RuntimeException { } } + @Override + public boolean onCreateOptionsMenu(Menu optionsMenu) { + getSupportMenuInflater().inflate(menu.repository_star, optionsMenu); + + return super.onCreateOptionsMenu(optionsMenu); + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + MenuItem followItem = menu.findItem(id.m_star); + + followItem.setVisible(starringStatusChecked); + followItem.setTitle(isStarring ? string.unstar : string.star); + + return super.onPrepareOptionsMenu(menu); + } + @Override public boolean onSearchRequested() { if (pager.getCurrentItem() == 1) { @@ -137,11 +163,15 @@ private void configurePager() { configureTabPager(); ViewUtils.setGone(loadingBar, true); setGone(false); + checkStarringRepositoryStatus(); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case id.m_star: + starRepository(); + return true; case android.R.id.home: Intent intent = new Intent(this, HomeActivity.class); intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); @@ -183,4 +213,58 @@ protected String getIcon(int position) { return super.getIcon(position); } } -} + + private void starRepository() { + if (isStarring) + new UnstarRepositoryTask(this, repository) { + + @Override + protected void onSuccess(Void v) throws Exception { + super.onSuccess(v); + + isStarring = !isStarring; + } + + @Override + protected void onException(Exception e) throws RuntimeException { + super.onException(e); + + ToastUtils.show(RepositoryViewActivity.this, + string.error_unstarring_repository); + } + }.start(); + else + new StarRepositoryTask(this, repository) { + + @Override + protected void onSuccess(Void v) throws Exception { + super.onSuccess(v); + + isStarring = !isStarring; + } + + @Override + protected void onException(Exception e) throws RuntimeException { + super.onException(e); + + ToastUtils.show(RepositoryViewActivity.this, + string.error_starring_repository); + } + }.start(); + } + + private void checkStarringRepositoryStatus() { + starringStatusChecked = false; + new StarringRepositoryTask(this, repository) { + + @Override + protected void onSuccess(Boolean watching) throws Exception { + super.onSuccess(watching); + + isStarring = watching; + starringStatusChecked = true; + invalidateOptionsMenu(); + } + }.execute(); + } +} \ No newline at end of file From bec6fc990497c8860790a733fc2159cdb76664b4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 09:42:43 -0700 Subject: [PATCH 0005/1055] Remove extra newline --- .../java/com/github/mobile/core/repo/StarringRepositoryTask.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java b/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java index 787043ca6..2f6b9502f 100644 --- a/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java +++ b/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java @@ -51,7 +51,6 @@ public StarringRepositoryTask(Context context, IRepositoryIdProvider repo) { @Override protected Boolean run(Account account) throws Exception { - return service.isWatching(repo); } From 65b728f9341e489ebf35f6b3f990936866038853 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 09:43:21 -0700 Subject: [PATCH 0006/1055] Rename StarringRepositoryTask to StarredRepositoryTask --- ...StarringRepositoryTask.java => StarredRepositoryTask.java} | 4 ++-- .../com/github/mobile/ui/repo/RepositoryViewActivity.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename app/src/main/java/com/github/mobile/core/repo/{StarringRepositoryTask.java => StarredRepositoryTask.java} (91%) diff --git a/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java b/app/src/main/java/com/github/mobile/core/repo/StarredRepositoryTask.java similarity index 91% rename from app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java rename to app/src/main/java/com/github/mobile/core/repo/StarredRepositoryTask.java index 2f6b9502f..96e0c90b4 100644 --- a/app/src/main/java/com/github/mobile/core/repo/StarringRepositoryTask.java +++ b/app/src/main/java/com/github/mobile/core/repo/StarredRepositoryTask.java @@ -28,7 +28,7 @@ /** * Task to check repository starring status */ -public class StarringRepositoryTask extends AuthenticatedUserTask { +public class StarredRepositoryTask extends AuthenticatedUserTask { private static final String TAG = "StarringRepositoryTask"; @@ -43,7 +43,7 @@ public class StarringRepositoryTask extends AuthenticatedUserTask { * @param context * @param repo */ - public StarringRepositoryTask(Context context, IRepositoryIdProvider repo) { + public StarredRepositoryTask(Context context, IRepositoryIdProvider repo) { super(context); this.repo = repo; diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 0c2cd9945..3b3bb4338 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -46,7 +46,7 @@ import com.github.mobile.core.repo.RepositoryUtils; import com.github.mobile.core.repo.UnstarRepositoryTask; import com.github.mobile.core.repo.StarRepositoryTask; -import com.github.mobile.core.repo.StarringRepositoryTask; +import com.github.mobile.core.repo.StarredRepositoryTask; import com.github.mobile.ui.TabPagerActivity; import com.github.mobile.ui.user.HomeActivity; import com.github.mobile.util.AvatarLoader; @@ -255,7 +255,7 @@ protected void onException(Exception e) throws RuntimeException { private void checkStarringRepositoryStatus() { starringStatusChecked = false; - new StarringRepositoryTask(this, repository) { + new StarredRepositoryTask(this, repository) { @Override protected void onSuccess(Boolean watching) throws Exception { From 5947421a2d9cd90df933b7655a57d879aa20ea6f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 09:44:09 -0700 Subject: [PATCH 0007/1055] Organize imports --- .../mobile/ui/repo/RepositoryViewActivity.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 3b3bb4338..1dcd7bd24 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -23,12 +23,6 @@ import static com.github.mobile.util.TypefaceUtils.ICON_COMMIT; import static com.github.mobile.util.TypefaceUtils.ICON_ISSUE_OPEN; import static com.github.mobile.util.TypefaceUtils.ICON_NEWS; - -import org.eclipse.egit.github.core.Repository; -import org.eclipse.egit.github.core.User; - -import roboguice.inject.InjectExtra; -import roboguice.inject.InjectView; import android.content.Intent; import android.os.Bundle; import android.widget.ProgressBar; @@ -44,15 +38,21 @@ import com.github.mobile.R.string; import com.github.mobile.core.repo.RefreshRepositoryTask; import com.github.mobile.core.repo.RepositoryUtils; -import com.github.mobile.core.repo.UnstarRepositoryTask; import com.github.mobile.core.repo.StarRepositoryTask; import com.github.mobile.core.repo.StarredRepositoryTask; +import com.github.mobile.core.repo.UnstarRepositoryTask; import com.github.mobile.ui.TabPagerActivity; import com.github.mobile.ui.user.HomeActivity; import com.github.mobile.util.AvatarLoader; import com.github.mobile.util.ToastUtils; import com.google.inject.Inject; +import org.eclipse.egit.github.core.Repository; +import org.eclipse.egit.github.core.User; + +import roboguice.inject.InjectExtra; +import roboguice.inject.InjectView; + /** * Activity to view a repository */ From ac277fca40ecc832ccb13bcba538e1b31c779200 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 09:44:49 -0700 Subject: [PATCH 0008/1055] Rename isStarring to isStarred --- .../mobile/ui/repo/RepositoryViewActivity.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 1dcd7bd24..10536ef80 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -78,7 +78,7 @@ public static Intent createIntent(Repository repository) { @InjectView(id.pb_loading) private ProgressBar loadingBar; - private boolean isStarring; + private boolean isStarred; private boolean starringStatusChecked; @@ -135,7 +135,7 @@ public boolean onPrepareOptionsMenu(Menu menu) { MenuItem followItem = menu.findItem(id.m_star); followItem.setVisible(starringStatusChecked); - followItem.setTitle(isStarring ? string.unstar : string.star); + followItem.setTitle(isStarred ? string.unstar : string.star); return super.onPrepareOptionsMenu(menu); } @@ -215,14 +215,14 @@ protected String getIcon(int position) { } private void starRepository() { - if (isStarring) + if (isStarred) new UnstarRepositoryTask(this, repository) { @Override protected void onSuccess(Void v) throws Exception { super.onSuccess(v); - isStarring = !isStarring; + isStarred = !isStarred; } @Override @@ -240,7 +240,7 @@ protected void onException(Exception e) throws RuntimeException { protected void onSuccess(Void v) throws Exception { super.onSuccess(v); - isStarring = !isStarring; + isStarred = !isStarred; } @Override @@ -261,7 +261,7 @@ private void checkStarringRepositoryStatus() { protected void onSuccess(Boolean watching) throws Exception { super.onSuccess(watching); - isStarring = watching; + isStarred = watching; starringStatusChecked = true; invalidateOptionsMenu(); } From d5166b7f1c7178e3f7bf01f1737d2aff55819367 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 09:45:20 -0700 Subject: [PATCH 0009/1055] Rename starringStatusChecked to starredStatusChecked --- .../com/github/mobile/ui/repo/RepositoryViewActivity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 10536ef80..76928f996 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -80,7 +80,7 @@ public static Intent createIntent(Repository repository) { private boolean isStarred; - private boolean starringStatusChecked; + private boolean starredStatusChecked; @Override protected void onCreate(Bundle savedInstanceState) { @@ -134,7 +134,7 @@ public boolean onCreateOptionsMenu(Menu optionsMenu) { public boolean onPrepareOptionsMenu(Menu menu) { MenuItem followItem = menu.findItem(id.m_star); - followItem.setVisible(starringStatusChecked); + followItem.setVisible(starredStatusChecked); followItem.setTitle(isStarred ? string.unstar : string.star); return super.onPrepareOptionsMenu(menu); @@ -254,7 +254,7 @@ protected void onException(Exception e) throws RuntimeException { } private void checkStarringRepositoryStatus() { - starringStatusChecked = false; + starredStatusChecked = false; new StarredRepositoryTask(this, repository) { @Override @@ -262,7 +262,7 @@ protected void onSuccess(Boolean watching) throws Exception { super.onSuccess(watching); isStarred = watching; - starringStatusChecked = true; + starredStatusChecked = true; invalidateOptionsMenu(); } }.execute(); From 8ea5ef9217c6bd8c1e42e10888183fc6cdc1666d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 09:47:22 -0700 Subject: [PATCH 0010/1055] Rename checkStarringRepositoryStatus to checkStarredRepositoryStatus --- .../com/github/mobile/ui/repo/RepositoryViewActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 76928f996..4cbadb423 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -163,7 +163,7 @@ private void configurePager() { configureTabPager(); ViewUtils.setGone(loadingBar, true); setGone(false); - checkStarringRepositoryStatus(); + checkStarredRepositoryStatus(); } @Override @@ -253,7 +253,7 @@ protected void onException(Exception e) throws RuntimeException { }.start(); } - private void checkStarringRepositoryStatus() { + private void checkStarredRepositoryStatus() { starredStatusChecked = false; new StarredRepositoryTask(this, repository) { From ee72fa9a64a435eb70e01296dbdd41c97b48721d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 10:23:00 -0700 Subject: [PATCH 0011/1055] Refresh repository list when viewed repository is changed --- .../java/com/github/mobile/RequestCodes.java | 5 ++++ .../java/com/github/mobile/ResultCodes.java | 29 +++++++++++++++++++ .../ui/repo/RepositoryListFragment.java | 16 +++++++++- .../ui/repo/RepositoryViewActivity.java | 4 +++ .../ui/repo/UserRepositoryListFragment.java | 16 +++++++++- 5 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/github/mobile/ResultCodes.java diff --git a/app/src/main/java/com/github/mobile/RequestCodes.java b/app/src/main/java/com/github/mobile/RequestCodes.java index 2422a4f96..27535392c 100644 --- a/app/src/main/java/com/github/mobile/RequestCodes.java +++ b/app/src/main/java/com/github/mobile/RequestCodes.java @@ -89,4 +89,9 @@ public interface RequestCodes { * Request to update the current reference */ int REF_UPDATE = 11; + + /** + * Request to view a repository + */ + int REPOSITORY_VIEW = 12; } diff --git a/app/src/main/java/com/github/mobile/ResultCodes.java b/app/src/main/java/com/github/mobile/ResultCodes.java new file mode 100644 index 000000000..427dc2f8c --- /dev/null +++ b/app/src/main/java/com/github/mobile/ResultCodes.java @@ -0,0 +1,29 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile; + +import static android.app.Activity.RESULT_FIRST_USER; + +/** + * Result codes + */ +public interface ResultCodes { + + /** + * Resource being viewed was modified + */ + int RESOURCE_CHANGED = RESULT_FIRST_USER; +} diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java index bb0c84602..40363f30e 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java @@ -16,8 +16,11 @@ package com.github.mobile.ui.repo; import static com.github.mobile.Intents.EXTRA_USER; +import static com.github.mobile.RequestCodes.REPOSITORY_VIEW; +import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; import static java.util.Locale.US; import android.app.Activity; +import android.content.Intent; import android.os.Bundle; import android.support.v4.content.Loader; import android.view.View; @@ -114,12 +117,23 @@ public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REPOSITORY_VIEW && resultCode == RESOURCE_CHANGED) { + forceRefresh(); + return; + } + + super.onActivityResult(requestCode, resultCode, data); + } + @Override public void onListItemClick(ListView list, View v, int position, long id) { Repository repo = (Repository) list.getItemAtPosition(position); if (recentRepos != null) recentRepos.add(repo); - startActivity(RepositoryViewActivity.createIntent(repo)); + startActivityForResult(RepositoryViewActivity.createIntent(repo), + REPOSITORY_VIEW); } @Override diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 4cbadb423..dccc484d7 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -18,6 +18,7 @@ import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; import static com.github.mobile.ui.repo.RepositoryPagerAdapter.ITEM_CODE; import static com.github.mobile.util.TypefaceUtils.ICON_CODE; import static com.github.mobile.util.TypefaceUtils.ICON_COMMIT; @@ -173,6 +174,7 @@ public boolean onOptionsItemSelected(MenuItem item) { starRepository(); return true; case android.R.id.home: + finish(); Intent intent = new Intent(this, HomeActivity.class); intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent); @@ -223,6 +225,7 @@ protected void onSuccess(Void v) throws Exception { super.onSuccess(v); isStarred = !isStarred; + setResult(RESOURCE_CHANGED); } @Override @@ -241,6 +244,7 @@ protected void onSuccess(Void v) throws Exception { super.onSuccess(v); isStarred = !isStarred; + setResult(RESOURCE_CHANGED); } @Override diff --git a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java index 067f551e5..e4eb0d83f 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java @@ -15,6 +15,9 @@ */ package com.github.mobile.ui.repo; +import static com.github.mobile.RequestCodes.REPOSITORY_VIEW; +import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; +import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ListView; @@ -85,9 +88,20 @@ protected SingleTypeAdapter createAdapter(List items) { items.toArray(new Repository[items.size()]), user); } + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REPOSITORY_VIEW && resultCode == RESOURCE_CHANGED) { + forceRefresh(); + return; + } + + super.onActivityResult(requestCode, resultCode, data); + } + @Override public void onListItemClick(ListView list, View v, int position, long id) { Repository repo = (Repository) list.getItemAtPosition(position); - startActivity(RepositoryViewActivity.createIntent(repo)); + startActivityForResult(RepositoryViewActivity.createIntent(repo), + REPOSITORY_VIEW); } } From adbbafd32c424d6e1cf496f65ec9d7059b03baeb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 10:24:51 -0700 Subject: [PATCH 0012/1055] Remove installLocation attribute Forces a re-login when the SD card is mounted if the app is moved to the SD card. --- app/AndroidManifest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index 6928901fb..eb1a4fdeb 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -1,7 +1,6 @@ From c52b1a43aa46d426ce42d135e3e960efc566f94e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Oct 2012 10:28:36 -0700 Subject: [PATCH 0013/1055] Support navigating up from CreateGistActivity --- .../com/github/mobile/ui/gist/CreateGistActivity.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java b/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java index 49062bfe9..ed429d1dd 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java @@ -15,6 +15,9 @@ */ package com.github.mobile.ui.gist; +import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; +import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; +import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; @@ -64,6 +67,7 @@ protected void onCreate(Bundle savedInstanceState) { ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(string.new_gist); actionBar.setIcon(drawable.action_gist); + actionBar.setDisplayHomeAsUpEnabled(true); String text = ShareUtils.getBody(getIntent()); if (!TextUtils.isEmpty(text)) @@ -107,6 +111,12 @@ public boolean onOptionsItemSelected(MenuItem item) { case id.m_apply: createGist(); return true; + case android.R.id.home: + finish(); + Intent intent = new Intent(this, GistsActivity.class); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + return true; default: return super.onOptionsItemSelected(item); } From ed61fc6f102d6032ad53c52ddfabb825a4dffda7 Mon Sep 17 00:00:00 2001 From: Johannes Schleifenbaum Date: Mon, 15 Oct 2012 19:41:27 +0200 Subject: [PATCH 0014/1055] added german locale for star/unstar repositories --- app/res/values-de/strings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/res/values-de/strings.xml b/app/res/values-de/strings.xml index c4a561200..ccac34a94 100644 --- a/app/res/values-de/strings.xml +++ b/app/res/values-de/strings.xml @@ -42,6 +42,9 @@ Folgen fehlgeschlagen Entfolgen fehlgeschlagen Prüfen des Folgestatus fehlgeschlagen + Favorisieren fehlgeschlagen + Entfernen des Favoriten fehlgeschlagen + Prüfen des Favoritenstatus fehlgeschlagen @@ -177,6 +180,8 @@ Ich folge Folgen Entfolgen + Favorisieren + Favorit entfernen Mitglieder Schließe Problem… Problem neu öffnen… @@ -224,6 +229,8 @@ Code Folgen… Entfolgen… + Favorisieren… + Favorit entfernen… Repositories From 90ab720c0d346c48a85af2e31288243e8c1f575b Mon Sep 17 00:00:00 2001 From: Johannes Schleifenbaum Date: Mon, 15 Oct 2012 10:58:14 -0700 Subject: [PATCH 0015/1055] Remove duplicate strings (star/unstar) Closes #253 --- app/res/values-de/strings.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/res/values-de/strings.xml b/app/res/values-de/strings.xml index ccac34a94..861bcabc0 100644 --- a/app/res/values-de/strings.xml +++ b/app/res/values-de/strings.xml @@ -136,9 +136,7 @@ erstellt mit Android Titel bearbeiten - Favorisieren Füge Gist als Favorit hinzu… - Favorit entfernen Entferne favorisierten Gist… Konten Verantwortlichen wählen From d6fb4f771ddda66b4aea82804ca66ec454a70035 Mon Sep 17 00:00:00 2001 From: Johannes Schleifenbaum Date: Mon, 15 Oct 2012 10:59:57 -0700 Subject: [PATCH 0016/1055] remove duplicate string (unstar/star) from default locale Closes #254 --- app/res/values/strings.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index ff28b263d..6610af3f4 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -139,9 +139,7 @@ Android created Gist Title Edit - Star Starring Gist… - Unstar Unstarring Gist… Accounts Select Assignee From 5cbbb2a6eb5ccbbdd890830d67aa6a73314b9af9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 19 Oct 2012 11:46:28 -0700 Subject: [PATCH 0017/1055] Memoize octicons typeface --- app/src/main/java/com/github/mobile/util/TypefaceUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/util/TypefaceUtils.java b/app/src/main/java/com/github/mobile/util/TypefaceUtils.java index 13f65a6fa..ce4c5ba9b 100644 --- a/app/src/main/java/com/github/mobile/util/TypefaceUtils.java +++ b/app/src/main/java/com/github/mobile/util/TypefaceUtils.java @@ -167,6 +167,8 @@ public class TypefaceUtils { */ public static final String ICON_BROADCAST = "\uf030"; + private static Typeface OCTICONS; + /** * Find the maximum number of digits in the given numbers * @@ -203,7 +205,9 @@ public static int getWidth(TextView view, int numberOfDigits) { * @return octicons typeface */ public static Typeface getOcticons(final Context context) { - return getTypeface(context, "octicons-regular-webfont.ttf"); + if (OCTICONS == null) + OCTICONS = getTypeface(context, "octicons-regular-webfont.ttf"); + return OCTICONS; } /** From 20fbc8068ef0c173af3fa3d34915cf0e5285f3b8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 08:28:49 -0700 Subject: [PATCH 0018/1055] Store view and extra variables from onCreate --- .../github/mobile/ui/repo/RepositoryViewActivity.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index dccc484d7..96224b1b3 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -51,9 +51,6 @@ import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; -import roboguice.inject.InjectExtra; -import roboguice.inject.InjectView; - /** * Activity to view a repository */ @@ -70,13 +67,11 @@ public static Intent createIntent(Repository repository) { return new Builder("repo.VIEW").repo(repository).toIntent(); } - @InjectExtra(EXTRA_REPOSITORY) private Repository repository; @Inject private AvatarLoader avatars; - @InjectView(id.pb_loading) private ProgressBar loadingBar; private boolean isStarred; @@ -87,6 +82,11 @@ public static Intent createIntent(Repository repository) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + repository = (Repository) getIntent().getSerializableExtra( + EXTRA_REPOSITORY); + + loadingBar = finder.find(id.pb_loading); + User owner = repository.getOwner(); ActionBar actionBar = getSupportActionBar(); From 68eb88c83a33b06d2b691bc5cfa2e4b5dea6ddb7 Mon Sep 17 00:00:00 2001 From: Erkan Date: Mon, 22 Oct 2012 08:32:53 -0700 Subject: [PATCH 0019/1055] Update French translation Closes #258 --- app/res/values-fr/strings.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/res/values-fr/strings.xml b/app/res/values-fr/strings.xml index 8395fbaef..83b73877e 100644 --- a/app/res/values-fr/strings.xml +++ b/app/res/values-fr/strings.xml @@ -42,6 +42,9 @@ Erreur lors de l\'abonnement Erreur lors du désabonnement Erreur lors de la vérification d\'abonnement + Erreur lors de l\'ajout aux favoris + Erreur lors de la suppression des favoris + Erreur lors de la vérification du favoris @@ -136,9 +139,7 @@ Gist créé sur Android Titre Modifier - Ajouter aux favoris Ajout du Gist aux favoris… - Supprimer des favoris Suppression du Gist des favoris… Comptes Sélectionner l\'assigné @@ -180,6 +181,8 @@ Abonnements S\'abonner Se désabonner + Ajouter aux favoris + Supprimer des favoris Membres Fermeture du ticket… Réouverture du ticket… @@ -227,6 +230,8 @@ Code Abonnement… Désabonnement… + Ajout aux favrois… + Supprimer des favoris… repositories From 32b3bba1fd56c427edca15c32f3aee2558a35c2b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 08:34:12 -0700 Subject: [PATCH 0020/1055] Use super class helper for getting serializable extra --- .../java/com/github/mobile/ui/repo/RepositoryViewActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 96224b1b3..fdab36ced 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -82,8 +82,7 @@ public static Intent createIntent(Repository repository) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - repository = (Repository) getIntent().getSerializableExtra( - EXTRA_REPOSITORY); + repository = getSerializableExtra(EXTRA_REPOSITORY); loadingBar = finder.find(id.pb_loading); From 9ba2dc9b13c3f9b656080e69ddba4ee2f7b2c65a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 08:36:49 -0700 Subject: [PATCH 0021/1055] Set view and intent fields from onCreate --- .../github/mobile/ui/DialogFragmentActivity.java | 10 ++++++++++ .../github/mobile/ui/commit/CommitViewActivity.java | 13 ++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java b/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java index 5c820f356..597c2e9a0 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java @@ -81,6 +81,16 @@ protected String[] getStringArrayExtra(final String name) { return getIntent().getStringArrayExtra(name); } + /** + * Get intent extra + * + * @param name + * @return char sequence array + */ + protected CharSequence[] getCharSequenceArrayExtra(final String name) { + return getIntent().getCharSequenceArrayExtra(name); + } + @Override public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { // Intentionally left blank diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java index dd2b60dde..2c1ce4575 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java @@ -42,9 +42,6 @@ import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryCommit; -import roboguice.inject.InjectExtra; -import roboguice.inject.InjectView; - /** * Activity to display a commit */ @@ -96,16 +93,12 @@ public static Intent createIntent(final Repository repository, return builder.toIntent(); } - @InjectView(id.vp_pages) private ViewPager pager; - @InjectExtra(EXTRA_REPOSITORY) private Repository repository; - @InjectExtra(EXTRA_BASES) private CharSequence[] ids; - @InjectExtra(EXTRA_POSITION) private int initialPosition; @Inject @@ -119,6 +112,12 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(layout.pager); + pager = finder.find(id.vp_pages); + + repository = getSerializableExtra(EXTRA_REPOSITORY); + ids = getCharSequenceArrayExtra(EXTRA_BASES); + initialPosition = getIntExtra(EXTRA_POSITION); + adapter = new CommitPagerAdapter(this, repository, ids); pager.setAdapter(adapter); pager.setOnPageChangeListener(this); From ce07f857a762a2bb1d68b9e2f980b5e7b72ac876 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 10:17:35 -0700 Subject: [PATCH 0022/1055] Add support for browsing commits on any tag or branch A ref selector is shown at the bottom of the commits list in the same style as the code tab. Closes #235 --- app/res/layout/commit_list.xml | 48 ++++++ app/res/layout/ref_footer.xml | 44 ++++++ app/res/layout/repo_code.xml | 60 +++----- .../com/github/mobile/core/ref/RefUtils.java | 30 +++- .../mobile/ui/commit/CommitListFragment.java | 145 +++++++++++++++++- .../com/github/mobile/ui/ref/RefDialog.java | 20 ++- .../ui/repo/RepositoryPagerAdapter.java | 13 +- 7 files changed, 303 insertions(+), 57 deletions(-) create mode 100644 app/res/layout/commit_list.xml create mode 100644 app/res/layout/ref_footer.xml diff --git a/app/res/layout/commit_list.xml b/app/res/layout/commit_list.xml new file mode 100644 index 000000000..6aa722df1 --- /dev/null +++ b/app/res/layout/commit_list.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/res/layout/ref_footer.xml b/app/res/layout/ref_footer.xml new file mode 100644 index 000000000..70f0626ad --- /dev/null +++ b/app/res/layout/ref_footer.xml @@ -0,0 +1,44 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/res/layout/repo_code.xml b/app/res/layout/repo_code.xml index 51e1a4067..4912ed61f 100644 --- a/app/res/layout/repo_code.xml +++ b/app/res/layout/repo_code.xml @@ -15,50 +15,26 @@ limitations under the License. --> - - + android:layout_width="match_parent" + android:layout_height="match_parent" > - + - + - - - - + \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/core/ref/RefUtils.java b/app/src/main/java/com/github/mobile/core/ref/RefUtils.java index abedda2cf..284d5d00b 100644 --- a/app/src/main/java/com/github/mobile/core/ref/RefUtils.java +++ b/app/src/main/java/com/github/mobile/core/ref/RefUtils.java @@ -53,11 +53,17 @@ public static boolean isBranch(final Reference ref) { * @return true if tag, false otherwise */ public static boolean isTag(final Reference ref) { - if (ref != null) { - String name = ref.getRef(); - return !TextUtils.isEmpty(name) && name.startsWith(PREFIX_TAG); - } else - return false; + return ref != null && isTag(ref.getRef()); + } + + /** + * Is reference a tag? + * + * @param name + * @return true if tag, false otherwise + */ + public static boolean isTag(final String name) { + return !TextUtils.isEmpty(name) && name.startsWith(PREFIX_TAG); } /** @@ -83,9 +89,19 @@ public static String getPath(final Reference ref) { * @return short name */ public static String getName(final Reference ref) { - if (ref == null) + if (ref != null) + return getName(ref.getRef()); + else return null; - String name = ref.getRef(); + } + + /** + * Get short name for ref + * + * @param name + * @return short name + */ + public static String getName(final String name) { if (TextUtils.isEmpty(name)) return name; if (name.startsWith(PREFIX_HEADS)) diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java index 146dafc8f..e14a32efb 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java @@ -15,37 +15,60 @@ */ package com.github.mobile.ui.commit; +import static android.app.Activity.RESULT_OK; import static com.github.mobile.Intents.EXTRA_REPOSITORY; import static com.github.mobile.RequestCodes.COMMIT_VIEW; +import static com.github.mobile.RequestCodes.REF_UPDATE; import android.content.Intent; import android.os.Bundle; +import android.support.v4.content.Loader; +import android.text.TextUtils; +import android.view.LayoutInflater; import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup; import android.widget.ListView; +import android.widget.TextView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; +import com.github.kevinsawicki.wishlist.ViewFinder; +import com.github.kevinsawicki.wishlist.ViewUtils; +import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.R.string; +import com.github.mobile.ThrowableLoader; import com.github.mobile.core.ResourcePager; import com.github.mobile.core.commit.CommitPager; import com.github.mobile.core.commit.CommitStore; +import com.github.mobile.core.ref.RefUtils; +import com.github.mobile.ui.DialogFragmentActivity; +import com.github.mobile.ui.DialogResultListener; +import com.github.mobile.ui.ItemListFragment; import com.github.mobile.ui.PagedItemFragment; +import com.github.mobile.ui.ref.RefDialog; +import com.github.mobile.ui.ref.RefDialogFragment; import com.github.mobile.util.AvatarLoader; +import com.github.mobile.util.TypefaceUtils; import com.google.inject.Inject; import java.util.List; import org.eclipse.egit.github.core.Commit; +import org.eclipse.egit.github.core.Reference; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryCommit; import org.eclipse.egit.github.core.client.PageIterator; import org.eclipse.egit.github.core.service.CommitService; +import org.eclipse.egit.github.core.service.DataService; +import org.eclipse.egit.github.core.service.RepositoryService; import roboguice.inject.InjectExtra; /** * Fragment to display a list of repository commits */ -public class CommitListFragment extends PagedItemFragment { +public class CommitListFragment extends PagedItemFragment + implements DialogResultListener { /** * Avatar loader @@ -62,6 +85,22 @@ public class CommitListFragment extends PagedItemFragment { @InjectExtra(EXTRA_REPOSITORY) private Repository repository; + private RefDialog dialog; + + private TextView branchIconView; + + private TextView branchView; + + private View branchFooterView; + + @Inject + private DataService dataService; + + @Inject + private RepositoryService repoService; + + private String ref; + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); @@ -69,6 +108,38 @@ public void onActivityCreated(Bundle savedInstanceState) { setEmptyText(string.no_commits); } + @Override + public Loader> onCreateLoader(int id, Bundle bundle) { + final ThrowableLoader> parentLoader = (ThrowableLoader>) super + .onCreateLoader(id, bundle); + return new ThrowableLoader>(getActivity(), items) { + + @Override + public List loadData() throws Exception { + if (TextUtils.isEmpty(ref)) { + String defaultBranch = repository.getMasterBranch(); + if (TextUtils.isEmpty(defaultBranch)) { + defaultBranch = repoService.getRepository(repository) + .getMasterBranch(); + if (TextUtils.isEmpty(defaultBranch)) + defaultBranch = "master"; + } + ref = defaultBranch; + } + + return parentLoader.loadData(); + } + }; + } + + public void onLoadFinished(Loader> loader, + List items) { + super.onLoadFinished(loader, items); + + if (ref != null) + updateRefLabel(); + } + @Override protected ResourcePager createPager() { return new CommitPager(repository, store) { @@ -91,7 +162,10 @@ protected RepositoryCommit register(RepositoryCommit resource) { @Override public PageIterator createIterator(int page, int size) { - return service.pageCommits(repository, last, null, size); + if (page > 1 || ref == null) + return service.pageCommits(repository, last, null, size); + else + return service.pageCommits(repository, ref, null, size); } @Override @@ -136,4 +210,71 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } + + @Override + public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { + if (RESULT_OK != resultCode) + return; + + switch (requestCode) { + case REF_UPDATE: + setRef(RefDialogFragment.getSelected(arguments)); + break; + } + } + + private void updateRefLabel() { + branchView.setText(RefUtils.getName(ref)); + if (RefUtils.isTag(ref)) + branchIconView.setText(string.icon_tag); + else + branchIconView.setText(string.icon_fork); + } + + private void setRef(final Reference ref) { + this.ref = ref.getRef(); + updateRefLabel(); + refreshWithProgress(); + } + + private void switchRefs() { + if (ref == null) + return; + + if (dialog == null) + dialog = new RefDialog((DialogFragmentActivity) getActivity(), + REF_UPDATE, repository, dataService); + dialog.show(new Reference().setRef(ref)); + } + + @Override + public ItemListFragment setListShown(boolean shown, + boolean animate) { + ViewUtils.setGone(branchFooterView, !shown); + return super.setListShown(shown, animate); + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + ViewFinder finder = new ViewFinder(view); + branchFooterView = finder.find(id.rl_branch); + branchView = finder.find(id.tv_branch); + branchIconView = finder.find(id.tv_branch_icon); + TypefaceUtils.setOcticons(branchIconView); + branchFooterView.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + switchRefs(); + } + }); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(layout.commit_list, null); + } } diff --git a/app/src/main/java/com/github/mobile/ui/ref/RefDialog.java b/app/src/main/java/com/github/mobile/ui/ref/RefDialog.java index b81924623..65df024ba 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/RefDialog.java +++ b/app/src/main/java/com/github/mobile/ui/ref/RefDialog.java @@ -118,14 +118,24 @@ public void show(Reference selectedRef) { return; } - final ArrayList users = new ArrayList( + final ArrayList refList = new ArrayList( refs.values()); int checked = -1; - if (selectedRef != null) - for (int i = 0; i < users.size(); i++) - if (selectedRef.getRef().equals(users.get(i).getRef())) + if (selectedRef != null) { + String ref = selectedRef.getRef(); + for (int i = 0; i < refList.size(); i++) { + String candidate = refList.get(i).getRef(); + if (ref.equals(candidate)) { checked = i; + break; + } else if (ref.equals(RefUtils.getName(candidate))) { + checked = i; + break; + } + } + } + RefDialogFragment.show(activity, requestCode, - activity.getString(string.select_ref), null, users, checked); + activity.getString(string.select_ref), null, refList, checked); } } diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryPagerAdapter.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryPagerAdapter.java index f08b00383..a453212af 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryPagerAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryPagerAdapter.java @@ -36,12 +36,19 @@ public class RepositoryPagerAdapter extends FragmentPagerAdapter { */ public static final int ITEM_CODE = 1; + /** + * Index of commits page + */ + public static final int ITEM_COMMITS = 2; + private final Resources resources; private final boolean hasIssues; private RepositoryCodeFragment codeFragment; + private CommitListFragment commitsFragment; + /** * Create repository pager adapter * @@ -81,7 +88,8 @@ public Fragment getItem(int position) { codeFragment = new RepositoryCodeFragment(); return codeFragment; case 2: - return new CommitListFragment(); + commitsFragment = new CommitListFragment(); + return commitsFragment; case 3: return new IssuesFragment(); default: @@ -116,6 +124,9 @@ public RepositoryPagerAdapter onDialogResult(int position, int requestCode, int resultCode, Bundle arguments) { if (position == ITEM_CODE && codeFragment != null) codeFragment.onDialogResult(requestCode, resultCode, arguments); + else if (position == ITEM_COMMITS && commitsFragment != null) + commitsFragment.onDialogResult(requestCode, resultCode, arguments); + return this; } } From 114d0e1f272098c8e60d04ac316a9236e33d4468 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 11:12:14 -0700 Subject: [PATCH 0023/1055] Remove extra newline and unneeded curlies --- app/src/main/java/com/github/mobile/ui/TabPagerActivity.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index db455683e..6acadc2b5 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -137,10 +137,8 @@ protected int getContentView() { private void updateCurrentItem(final int newPosition) { if (newPosition > -1 && newPosition < adapter.getCount() - && pager.setItem(newPosition)) { - + && pager.setItem(newPosition)) setCurrentItem(newPosition); - } } private void createPager() { From 50eed5040bbc2df65cdb12b32b697264813e58fc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 12:08:08 -0700 Subject: [PATCH 0024/1055] Add ability to preview comments as markdown --- app/res/layout/comment_create.xml | 34 +++-- app/res/layout/comment_preview.xml | 48 +++++++ app/res/values/strings.xml | 2 + .../com/github/mobile/ServicesModule.java | 6 + .../com/github/mobile/ui/MarkdownLoader.java | 79 ++++++++++++ .../comment/CommentPreviewPagerAdapter.java | 86 +++++++++++++ .../ui/comment/CreateCommentActivity.java | 84 +++++++++---- .../mobile/ui/comment/RawCommentFragment.java | 67 ++++++++++ .../ui/comment/RenderedCommentFragment.java | 119 ++++++++++++++++++ .../ui/commit/CreateCommentActivity.java | 10 +- .../ui/issue/CreateCommentActivity.java | 19 +-- .../com/github/mobile/util/TypefaceUtils.java | 5 + 12 files changed, 504 insertions(+), 55 deletions(-) create mode 100644 app/res/layout/comment_preview.xml create mode 100644 app/src/main/java/com/github/mobile/ui/MarkdownLoader.java create mode 100644 app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java create mode 100644 app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java create mode 100644 app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java diff --git a/app/res/layout/comment_create.xml b/app/res/layout/comment_create.xml index 9c965e7a7..140b73159 100644 --- a/app/res/layout/comment_create.xml +++ b/app/res/layout/comment_create.xml @@ -15,27 +15,21 @@ limitations under the License. --> - - + android:layout_width="match_parent" + android:layout_height="match_parent" > - + - - + + \ No newline at end of file diff --git a/app/res/layout/comment_preview.xml b/app/res/layout/comment_preview.xml new file mode 100644 index 000000000..14d969e2c --- /dev/null +++ b/app/res/layout/comment_preview.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index 6610af3f4..54d614f56 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -254,5 +254,7 @@ Share Show password + Write + Preview diff --git a/app/src/main/java/com/github/mobile/ServicesModule.java b/app/src/main/java/com/github/mobile/ServicesModule.java index 3db4ec2bb..1c312b679 100644 --- a/app/src/main/java/com/github/mobile/ServicesModule.java +++ b/app/src/main/java/com/github/mobile/ServicesModule.java @@ -29,6 +29,7 @@ import org.eclipse.egit.github.core.service.GistService; import org.eclipse.egit.github.core.service.IssueService; import org.eclipse.egit.github.core.service.LabelService; +import org.eclipse.egit.github.core.service.MarkdownService; import org.eclipse.egit.github.core.service.MilestoneService; import org.eclipse.egit.github.core.service.OrganizationService; import org.eclipse.egit.github.core.service.PullRequestService; @@ -114,4 +115,9 @@ CommitService commitService(GitHubClient client) { DataService dataService(GitHubClient client) { return new DataService(client); } + + @Provides + MarkdownService markdownService(GitHubClient client) { + return new MarkdownService(client); + } } diff --git a/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java b/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java new file mode 100644 index 000000000..ac1d5e201 --- /dev/null +++ b/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java @@ -0,0 +1,79 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.ui; + +import static org.eclipse.egit.github.core.service.MarkdownService.MODE_GFM; +import android.accounts.Account; +import android.content.Context; +import android.text.Html.ImageGetter; + +import com.github.mobile.accounts.AuthenticatedUserLoader; +import com.github.mobile.util.HtmlUtils; +import com.google.inject.Inject; + +import java.io.IOException; + +import org.eclipse.egit.github.core.IRepositoryIdProvider; +import org.eclipse.egit.github.core.service.MarkdownService; + +/** + * Markdown loader + */ +public class MarkdownLoader extends AuthenticatedUserLoader { + + private final ImageGetter imageGetter; + + private final IRepositoryIdProvider repository; + + private final String raw; + + @Inject + private MarkdownService service; + + /** + * @param context + * @param repository + * @param raw + * @param imageGetter + */ + public MarkdownLoader(Context context, IRepositoryIdProvider repository, + String raw, ImageGetter imageGetter) { + super(context); + + this.repository = repository; + this.raw = raw; + this.imageGetter = imageGetter; + } + + @Override + protected CharSequence getAccountFailureData() { + return null; + } + + @Override + public CharSequence load(Account account) { + try { + String html; + if (repository != null) + html = service.getRepositoryHtml(repository, raw); + else + html = service.getHtml(raw, MODE_GFM); + return HtmlUtils.encode(html, imageGetter); + } catch (IOException e) { + return null; + } + } +} diff --git a/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java b/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java new file mode 100644 index 000000000..821f36282 --- /dev/null +++ b/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java @@ -0,0 +1,86 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.ui.comment; + +import android.support.v4.app.Fragment; + +import com.actionbarsherlock.app.SherlockFragmentActivity; +import com.github.mobile.ui.FragmentPagerAdapter; + +import org.eclipse.egit.github.core.IRepositoryIdProvider; + +/** + * Pager of a raw and rendered comment text + */ +public class CommentPreviewPagerAdapter extends FragmentPagerAdapter { + + private final IRepositoryIdProvider repo; + + private RawCommentFragment textFragment; + + private RenderedCommentFragment htmlFragment; + + /** + * @param activity + * @param repo + */ + public CommentPreviewPagerAdapter(SherlockFragmentActivity activity, + IRepositoryIdProvider repo) { + super(activity); + + this.repo = repo; + } + + @Override + public Fragment getItem(final int position) { + switch (position) { + case 0: + textFragment = new RawCommentFragment(); + return textFragment; + case 1: + htmlFragment = new RenderedCommentFragment(); + return htmlFragment; + default: + return null; + } + } + + @Override + public int getCount() { + return 2; + } + + /** + * Get comment text + * + * @return text + */ + public String getCommentText() { + return textFragment != null ? textFragment.getText() : null; + } + + /** + * Set current item + * + * @param position + * @return this adapter + */ + public CommentPreviewPagerAdapter setCurrentItem(int position) { + if (position == 1 && htmlFragment != null) + htmlFragment.setText(getCommentText(), repo); + return this; + } +} diff --git a/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java b/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java index 84bddf380..4d15ddade 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java @@ -16,28 +16,30 @@ package com.github.mobile.ui.comment; import static com.github.mobile.Intents.EXTRA_COMMENT; +import static com.github.mobile.util.TypefaceUtils.ICON_EDIT; +import static com.github.mobile.util.TypefaceUtils.ICON_WATCH; import android.content.Intent; import android.os.Bundle; -import android.text.Editable; import android.text.TextUtils; -import android.widget.EditText; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; import com.github.mobile.R.id; -import com.github.mobile.R.layout; -import com.github.mobile.R.menu; -import com.github.mobile.ui.BaseActivity; -import com.github.mobile.ui.TextWatcherAdapter; +import com.github.mobile.R.string; +import com.github.mobile.ui.TabPagerActivity; import com.github.mobile.util.AvatarLoader; import com.google.inject.Inject; +import com.viewpagerindicator.R.menu; import org.eclipse.egit.github.core.Comment; /** * Base activity for creating comments */ -public abstract class CreateCommentActivity extends BaseActivity { +public abstract class CreateCommentActivity extends + TabPagerActivity { + + private MenuItem applyItem; /** * Avatar loader @@ -45,32 +47,28 @@ public abstract class CreateCommentActivity extends BaseActivity { @Inject protected AvatarLoader avatars; - private EditText commentText; - - private MenuItem applyItem; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(layout.comment_create); + configureTabPager(); + } + + @Override + public void invalidateOptionsMenu() { + super.invalidateOptionsMenu(); - commentText = finder.find(id.et_comment); - commentText.addTextChangedListener(new TextWatcherAdapter() { + if (applyItem != null) + applyItem.setEnabled(adapter != null + && !TextUtils.isEmpty(adapter.getCommentText())); - @Override - public void afterTextChanged(Editable s) { - if (applyItem != null) - applyItem.setEnabled(!TextUtils.isEmpty(s)); - } - }); } @Override - public boolean onCreateOptionsMenu(Menu options) { - getSupportMenuInflater().inflate(menu.comment, options); - applyItem = options.findItem(id.m_apply); - return true; + protected void setCurrentItem(int position) { + super.setCurrentItem(position); + + adapter.setCurrentItem(position); } /** @@ -96,10 +94,46 @@ protected void finish(Comment comment) { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case id.m_apply: - createComment(commentText.getText().toString()); + createComment(adapter.getCommentText()); return true; default: return super.onOptionsItemSelected(item); } } + + @Override + protected String getTitle(final int position) { + switch (position) { + case 0: + return getString(string.write); + case 1: + return getString(string.preview); + default: + return super.getTitle(position); + } + } + + @Override + protected String getIcon(final int position) { + switch (position) { + case 0: + return ICON_EDIT; + case 1: + return ICON_WATCH; + default: + return super.getIcon(position); + } + } + + @Override + protected CommentPreviewPagerAdapter createAdapter() { + return new CommentPreviewPagerAdapter(this, null); + } + + @Override + public boolean onCreateOptionsMenu(Menu options) { + getSupportMenuInflater().inflate(menu.comment, options); + applyItem = options.findItem(id.m_apply); + return true; + } } diff --git a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java new file mode 100644 index 000000000..cea93430c --- /dev/null +++ b/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java @@ -0,0 +1,67 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.ui.comment; + +import android.os.Bundle; +import android.text.Editable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.EditText; + +import com.github.kevinsawicki.wishlist.ViewFinder; +import com.github.mobile.R.id; +import com.github.mobile.R.layout; +import com.github.mobile.ui.TextWatcherAdapter; +import com.github.rtyley.android.sherlock.roboguice.fragment.RoboSherlockFragment; + +/** + * Fragment to display raw comment text + */ +public class RawCommentFragment extends RoboSherlockFragment { + + private EditText commentText; + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + ViewFinder finder = new ViewFinder(view); + commentText = finder.find(id.et_comment); + commentText.addTextChangedListener(new TextWatcherAdapter() { + + @Override + public void afterTextChanged(Editable s) { + getActivity().invalidateOptionsMenu(); + } + }); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(layout.comment_create, null); + } + + /** + * Get comment text + * + * @return text + */ + public String getText() { + return commentText.getText().toString(); + } +} diff --git a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java new file mode 100644 index 000000000..8db558ee4 --- /dev/null +++ b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java @@ -0,0 +1,119 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.ui.comment; + +import android.os.Bundle; +import android.support.v4.app.LoaderManager.LoaderCallbacks; +import android.support.v4.content.Loader; +import android.text.Html.ImageGetter; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ProgressBar; +import android.widget.TextView; + +import com.actionbarsherlock.R.id; +import com.github.kevinsawicki.wishlist.ViewFinder; +import com.github.kevinsawicki.wishlist.ViewUtils; +import com.github.mobile.R.layout; +import com.github.mobile.ui.MarkdownLoader; +import com.github.mobile.util.HttpImageGetter; +import com.github.mobile.util.ToastUtils; +import com.github.rtyley.android.sherlock.roboguice.fragment.RoboSherlockFragment; + +import java.io.Serializable; + +import org.eclipse.egit.github.core.IRepositoryIdProvider; + +/** + * Fragment to display rendered comment fragment + */ +public class RenderedCommentFragment extends RoboSherlockFragment implements + LoaderCallbacks { + + private static final String ARG_TEXT = "text"; + + private static final String ARG_REPO = "repo"; + + private ProgressBar progress; + + private TextView bodyText; + + private ImageGetter imageGetter; + + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + + imageGetter = new HttpImageGetter(getActivity()); + } + + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + ViewFinder finder = new ViewFinder(view); + progress = finder.find(id.pb_loading); + bodyText = finder.find(id.tv_comment_body); + } + + /** + * Set text to render + * + * @param raw + * @param repo + */ + public void setText(final String raw, final IRepositoryIdProvider repo) { + Bundle args = new Bundle(); + args.putCharSequence(ARG_TEXT, raw); + if (repo instanceof Serializable) + args.putSerializable(ARG_REPO, (Serializable) repo); + getLoaderManager().restartLoader(0, args, this); + showLoading(true); + } + + private void showLoading(final boolean loading) { + ViewUtils.setGone(progress, !loading); + ViewUtils.setGone(bodyText, loading); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(layout.comment_preview, null); + } + + @Override + public Loader onCreateLoader(int loader, Bundle args) { + final CharSequence raw = args.getCharSequence(ARG_TEXT); + final IRepositoryIdProvider repo = (IRepositoryIdProvider) args + .getSerializable(ARG_REPO); + return new MarkdownLoader(getActivity(), repo, raw.toString(), + imageGetter); + } + + @Override + public void onLoadFinished(Loader loader, + CharSequence rendered) { + if (rendered == null) + ToastUtils.show(getActivity(), + "Rendering comment as markdown failed"); + bodyText.setText(rendered); + showLoading(false); + } + + @Override + public void onLoaderReset(Loader loader) { + } +} diff --git a/app/src/main/java/com/github/mobile/ui/commit/CreateCommentActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CreateCommentActivity.java index 24890d32c..97925e623 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CreateCommentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CreateCommentActivity.java @@ -27,6 +27,7 @@ import com.github.mobile.Intents.Builder; import com.github.mobile.R.string; import com.github.mobile.core.commit.CommitUtils; +import com.github.mobile.ui.comment.CommentPreviewPagerAdapter; import org.eclipse.egit.github.core.CommitComment; import org.eclipse.egit.github.core.Repository; @@ -81,13 +82,13 @@ private static boolean isLineComment(final String path, final int position) { @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - repository = getSerializableExtra(EXTRA_REPOSITORY); commit = getStringExtra(EXTRA_BASE); position = getIntExtra(EXTRA_POSITION); path = getStringExtra(EXTRA_PATH); + super.onCreate(savedInstanceState); + ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(getString(string.commit_prefix) + CommitUtils.abbreviate(commit)); @@ -112,4 +113,9 @@ protected void onSuccess(CommitComment comment) throws Exception { }.start(); } + + @Override + protected CommentPreviewPagerAdapter createAdapter() { + return new CommentPreviewPagerAdapter(this, repository); + } } diff --git a/app/src/main/java/com/github/mobile/ui/issue/CreateCommentActivity.java b/app/src/main/java/com/github/mobile/ui/issue/CreateCommentActivity.java index 333e9b21d..92300ecb8 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/CreateCommentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/CreateCommentActivity.java @@ -25,6 +25,7 @@ import com.actionbarsherlock.app.ActionBar; import com.github.mobile.Intents.Builder; import com.github.mobile.R.string; +import com.github.mobile.ui.comment.CommentPreviewPagerAdapter; import org.eclipse.egit.github.core.Comment; import org.eclipse.egit.github.core.Issue; @@ -60,19 +61,16 @@ public static Intent createIntent(RepositoryId repoId, int issueNumber, @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - issueNumber = getIntExtra(EXTRA_ISSUE_NUMBER); + repositoryId = new RepositoryId(getStringExtra(EXTRA_REPOSITORY_OWNER), + getStringExtra(EXTRA_REPOSITORY_NAME)); + + super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); - Intent intent = getIntent(); - repositoryId = new RepositoryId( - intent.getStringExtra(EXTRA_REPOSITORY_OWNER), - intent.getStringExtra(EXTRA_REPOSITORY_NAME)); actionBar.setTitle(getString(string.issue_title) + issueNumber); - actionBar.setSubtitle(repositoryId.generateId()); - avatars.bind(actionBar, (User) intent.getSerializableExtra(EXTRA_USER)); + avatars.bind(actionBar, (User) getSerializableExtra(EXTRA_USER)); } @Override @@ -87,4 +85,9 @@ protected void onSuccess(Comment comment) throws Exception { } }.start(); } + + @Override + protected CommentPreviewPagerAdapter createAdapter() { + return new CommentPreviewPagerAdapter(this, repositoryId); + } } diff --git a/app/src/main/java/com/github/mobile/util/TypefaceUtils.java b/app/src/main/java/com/github/mobile/util/TypefaceUtils.java index ce4c5ba9b..72222deed 100644 --- a/app/src/main/java/com/github/mobile/util/TypefaceUtils.java +++ b/app/src/main/java/com/github/mobile/util/TypefaceUtils.java @@ -167,6 +167,11 @@ public class TypefaceUtils { */ public static final String ICON_BROADCAST = "\uf030"; + /** + * Edit icon + */ + public static final String ICON_EDIT = "\uf058"; + private static Typeface OCTICONS; /** From 9e3594e667e3bdaa157b106d86811e73cc936a26 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 12:11:39 -0700 Subject: [PATCH 0025/1055] Externalize failure strings --- app/res/values/strings.xml | 1 + .../com/github/mobile/ui/comment/RenderedCommentFragment.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index 54d614f56..d00cdcaf6 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -45,6 +45,7 @@ Starring failed Unstarring failed Checking starring status failed + Rendering markdown failed diff --git a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java index 8db558ee4..c83fb04a1 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java +++ b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java @@ -29,6 +29,7 @@ import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.layout; +import com.github.mobile.R.string; import com.github.mobile.ui.MarkdownLoader; import com.github.mobile.util.HttpImageGetter; import com.github.mobile.util.ToastUtils; @@ -107,8 +108,7 @@ public Loader onCreateLoader(int loader, Bundle args) { public void onLoadFinished(Loader loader, CharSequence rendered) { if (rendered == null) - ToastUtils.show(getActivity(), - "Rendering comment as markdown failed"); + ToastUtils.show(getActivity(), string.error_rendering_markdown); bodyText.setText(rendered); showLoading(false); } From dd0cd0f554f244e708bee73d02d4792a885cc768 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 13:08:09 -0700 Subject: [PATCH 0026/1055] Remove unneeded null initialization --- .../com/github/mobile/accounts/AccountAuthenticatorService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticatorService.java b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticatorService.java index cbafcd659..569aa62b9 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticatorService.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticatorService.java @@ -26,7 +26,7 @@ */ public class AccountAuthenticatorService extends Service { - private static AccountAuthenticator AUTHENTICATOR = null; + private static AccountAuthenticator AUTHENTICATOR; public IBinder onBind(Intent intent) { return intent.getAction().equals(ACTION_AUTHENTICATOR_INTENT) ? getAuthenticator() From 336b5df191bde16bea58f5928a47463a863c14f0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 13:09:26 -0700 Subject: [PATCH 0027/1055] Log cause exception when authorization fails --- .../com/github/mobile/accounts/AccountAuthenticator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java index d73629ca5..cc3c5190f 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java @@ -125,8 +125,8 @@ private Intent createLoginIntent(AccountAuthenticatorResponse response) { * @return token or null if none found * @throws IOException */ - private String getAuthorization(OAuthService service, - List scopes) throws IOException { + private String getAuthorization(OAuthService service, List scopes) + throws IOException { for (Authorization auth : service.getAuthorizations()) if (isValidAuthorization(auth, scopes)) return auth.getToken(); @@ -190,7 +190,7 @@ public Bundle getAuthToken(AccountAuthenticatorResponse response, } return bundle; } catch (IOException e) { - Log.e(TAG, e.getMessage()); + Log.e(TAG, "Authorization retrieval failed", e); throw new NetworkErrorException(e); } } From 47068178b0883872f6ed79d47b71e14975c1ed53 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 13:11:36 -0700 Subject: [PATCH 0028/1055] Add missing Override annotation --- .../java/com/github/mobile/ui/code/RepositoryCodeFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java index c893f919b..d2efc3cfb 100644 --- a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java +++ b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java @@ -227,6 +227,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) { branchIconView = finder.find(id.tv_branch_icon); branchFooterView.setOnClickListener(new OnClickListener() { + @Override public void onClick(View v) { switchBranches(); } From 73ffa8150a50e1499e2299ec4a2f5b2822be45ac Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 13:13:12 -0700 Subject: [PATCH 0029/1055] Log exception when loading rendered markdown fails --- app/src/main/java/com/github/mobile/ui/MarkdownLoader.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java b/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java index ac1d5e201..c42aa280d 100644 --- a/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java +++ b/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java @@ -19,6 +19,7 @@ import android.accounts.Account; import android.content.Context; import android.text.Html.ImageGetter; +import android.util.Log; import com.github.mobile.accounts.AuthenticatedUserLoader; import com.github.mobile.util.HtmlUtils; @@ -34,6 +35,8 @@ */ public class MarkdownLoader extends AuthenticatedUserLoader { + private static final String TAG = "MarkdownLoader"; + private final ImageGetter imageGetter; private final IRepositoryIdProvider repository; @@ -73,6 +76,7 @@ public CharSequence load(Account account) { html = service.getHtml(raw, MODE_GFM); return HtmlUtils.encode(html, imageGetter); } catch (IOException e) { + Log.d(TAG, "Loading rendered markdown failed", e); return null; } } From fc12d3f4aae635e6fe6bfc3dd0b3224dd1c1db10 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 14:38:11 -0700 Subject: [PATCH 0030/1055] Remove unneeded language mode index.html files --- app/assets/mode/clike/index.html | 101 ---- app/assets/mode/clike/scala.html | 765 ------------------------ app/assets/mode/clojure/index.html | 66 -- app/assets/mode/coffeescript/index.html | 727 ---------------------- app/assets/mode/css/index.html | 55 -- app/assets/mode/diff/index.html | 104 ---- app/assets/mode/ecl/index.html | 42 -- app/assets/mode/erlang/index.html | 62 -- app/assets/mode/gfm/index.html | 47 -- app/assets/mode/go/index.html | 72 --- app/assets/mode/groovy/index.html | 71 --- app/assets/mode/haskell/index.html | 60 -- app/assets/mode/haxe/index.html | 90 --- app/assets/mode/htmlembedded/index.html | 49 -- app/assets/mode/htmlmixed/index.html | 51 -- app/assets/mode/javascript/index.html | 77 --- app/assets/mode/jinja2/index.html | 37 -- app/assets/mode/less/index.html | 618 ------------------- app/assets/mode/lua/index.html | 72 --- app/assets/mode/markdown/index.html | 340 ----------- app/assets/mode/mysql/index.html | 41 -- app/assets/mode/ntriples/index.html | 32 - app/assets/mode/ocaml/index.html | 130 ---- app/assets/mode/pascal/index.html | 48 -- app/assets/mode/perl/index.html | 62 -- app/assets/mode/php/index.html | 48 -- app/assets/mode/pig/index.html | 42 -- app/assets/mode/plsql/index.html | 62 -- app/assets/mode/properties/index.html | 40 -- app/assets/mode/python/index.html | 122 ---- app/assets/mode/r/index.html | 73 --- app/assets/mode/rpm/changes/index.html | 53 -- app/assets/mode/rpm/spec/index.html | 99 --- app/assets/mode/rst/index.html | 525 ---------------- app/assets/mode/ruby/index.html | 171 ------ app/assets/mode/rust/index.html | 48 -- app/assets/mode/scheme/index.html | 64 -- app/assets/mode/shell/index.html | 50 -- app/assets/mode/smalltalk/index.html | 55 -- app/assets/mode/smarty/index.html | 82 --- app/assets/mode/sparql/index.html | 40 -- app/assets/mode/stex/index.html | 95 --- app/assets/mode/stex/test.html | 263 -------- app/assets/mode/tiddlywiki/index.html | 140 ----- app/assets/mode/tiki/index.html | 82 --- app/assets/mode/vb/index.html | 88 --- app/assets/mode/vbscript/index.html | 42 -- app/assets/mode/velocity/index.html | 103 ---- app/assets/mode/verilog/index.html | 210 ------- app/assets/mode/xml/index.html | 44 -- app/assets/mode/xquery/index.html | 222 ------- app/assets/mode/xquery/test/index.html | 27 - app/assets/mode/yaml/index.html | 67 --- 53 files changed, 6776 deletions(-) delete mode 100644 app/assets/mode/clike/index.html delete mode 100644 app/assets/mode/clike/scala.html delete mode 100644 app/assets/mode/clojure/index.html delete mode 100644 app/assets/mode/coffeescript/index.html delete mode 100644 app/assets/mode/css/index.html delete mode 100644 app/assets/mode/diff/index.html delete mode 100644 app/assets/mode/ecl/index.html delete mode 100644 app/assets/mode/erlang/index.html delete mode 100644 app/assets/mode/gfm/index.html delete mode 100644 app/assets/mode/go/index.html delete mode 100644 app/assets/mode/groovy/index.html delete mode 100644 app/assets/mode/haskell/index.html delete mode 100644 app/assets/mode/haxe/index.html delete mode 100644 app/assets/mode/htmlembedded/index.html delete mode 100644 app/assets/mode/htmlmixed/index.html delete mode 100644 app/assets/mode/javascript/index.html delete mode 100644 app/assets/mode/jinja2/index.html delete mode 100644 app/assets/mode/less/index.html delete mode 100644 app/assets/mode/lua/index.html delete mode 100644 app/assets/mode/markdown/index.html delete mode 100644 app/assets/mode/mysql/index.html delete mode 100644 app/assets/mode/ntriples/index.html delete mode 100644 app/assets/mode/ocaml/index.html delete mode 100644 app/assets/mode/pascal/index.html delete mode 100644 app/assets/mode/perl/index.html delete mode 100644 app/assets/mode/php/index.html delete mode 100644 app/assets/mode/pig/index.html delete mode 100644 app/assets/mode/plsql/index.html delete mode 100755 app/assets/mode/properties/index.html delete mode 100644 app/assets/mode/python/index.html delete mode 100644 app/assets/mode/r/index.html delete mode 100644 app/assets/mode/rpm/changes/index.html delete mode 100644 app/assets/mode/rpm/spec/index.html delete mode 100644 app/assets/mode/rst/index.html delete mode 100644 app/assets/mode/ruby/index.html delete mode 100644 app/assets/mode/rust/index.html delete mode 100644 app/assets/mode/scheme/index.html delete mode 100644 app/assets/mode/shell/index.html delete mode 100644 app/assets/mode/smalltalk/index.html delete mode 100644 app/assets/mode/smarty/index.html delete mode 100644 app/assets/mode/sparql/index.html delete mode 100644 app/assets/mode/stex/index.html delete mode 100644 app/assets/mode/stex/test.html delete mode 100644 app/assets/mode/tiddlywiki/index.html delete mode 100644 app/assets/mode/tiki/index.html delete mode 100644 app/assets/mode/vb/index.html delete mode 100644 app/assets/mode/vbscript/index.html delete mode 100644 app/assets/mode/velocity/index.html delete mode 100644 app/assets/mode/verilog/index.html delete mode 100644 app/assets/mode/xml/index.html delete mode 100644 app/assets/mode/xquery/index.html delete mode 100644 app/assets/mode/xquery/test/index.html delete mode 100644 app/assets/mode/yaml/index.html diff --git a/app/assets/mode/clike/index.html b/app/assets/mode/clike/index.html deleted file mode 100644 index 64d02f11e..000000000 --- a/app/assets/mode/clike/index.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - CodeMirror: C-like mode - - - - - - - -

CodeMirror: C-like mode

- -
- - - -

Simple mode that tries to handle C-like languages as well as it - can. Takes two configuration parameters: keywords, an - object whose property names are the keywords in the language, - and useCPP, which determines whether C preprocessor - directives are recognized.

- -

MIME types defined: text/x-csrc - (C code), text/x-c++src (C++ - code), text/x-java (Java - code), text/x-csharp (C#).

- - diff --git a/app/assets/mode/clike/scala.html b/app/assets/mode/clike/scala.html deleted file mode 100644 index 5fdd84ede..000000000 --- a/app/assets/mode/clike/scala.html +++ /dev/null @@ -1,765 +0,0 @@ - - - - CodeMirror: C-like mode - - - - - - - - -
- -
- - - - diff --git a/app/assets/mode/clojure/index.html b/app/assets/mode/clojure/index.html deleted file mode 100644 index 9762d5892..000000000 --- a/app/assets/mode/clojure/index.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - CodeMirror: Clojure mode - - - - - - - -

CodeMirror: Clojure mode

-
- - -

MIME types defined: text/x-clojure.

- - - diff --git a/app/assets/mode/coffeescript/index.html b/app/assets/mode/coffeescript/index.html deleted file mode 100644 index 98bd4971e..000000000 --- a/app/assets/mode/coffeescript/index.html +++ /dev/null @@ -1,727 +0,0 @@ - - - - CodeMirror: CoffeeScript mode - - - - - - - -

CodeMirror: CoffeeScript mode

-
- - -

MIME types defined: text/x-coffeescript.

- -

The CoffeeScript mode was written by Jeff Pickhardt (license).

- - - diff --git a/app/assets/mode/css/index.html b/app/assets/mode/css/index.html deleted file mode 100644 index 49934346d..000000000 --- a/app/assets/mode/css/index.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - CodeMirror: CSS mode - - - - - - - -

CodeMirror: CSS mode

-
- - -

MIME types defined: text/css.

- - - diff --git a/app/assets/mode/diff/index.html b/app/assets/mode/diff/index.html deleted file mode 100644 index b102c090f..000000000 --- a/app/assets/mode/diff/index.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - CodeMirror: Diff mode - - - - - - - -

CodeMirror: Diff mode

-
- - -

MIME types defined: text/x-diff.

- - - diff --git a/app/assets/mode/ecl/index.html b/app/assets/mode/ecl/index.html deleted file mode 100644 index d6b41f4e5..000000000 --- a/app/assets/mode/ecl/index.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - CodeMirror: ECL mode - - - - - - - -

CodeMirror: ECL mode

-
- - -

Based on CodeMirror's clike mode. For more information see HPCC Systems web site.

-

MIME types defined: text/x-ecl.

- - - diff --git a/app/assets/mode/erlang/index.html b/app/assets/mode/erlang/index.html deleted file mode 100644 index 80eefef46..000000000 --- a/app/assets/mode/erlang/index.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - CodeMirror: Erlang mode - - - - - - - - -

CodeMirror: Erlang mode

- -
- - - -

MIME types defined: text/x-erlang.

- - diff --git a/app/assets/mode/gfm/index.html b/app/assets/mode/gfm/index.html deleted file mode 100644 index b27d49abe..000000000 --- a/app/assets/mode/gfm/index.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - CodeMirror: GFM mode - - - - - - - - - - - -

CodeMirror: GFM mode

- - -
- - - - - diff --git a/app/assets/mode/go/index.html b/app/assets/mode/go/index.html deleted file mode 100644 index 9cdad1ada..000000000 --- a/app/assets/mode/go/index.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - CodeMirror: Go mode - - - - - - - - -

CodeMirror: Go mode

- -
- - - -

MIME type: text/x-go

- - diff --git a/app/assets/mode/groovy/index.html b/app/assets/mode/groovy/index.html deleted file mode 100644 index 226475caa..000000000 --- a/app/assets/mode/groovy/index.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - CodeMirror: Groovy mode - - - - - - - -

CodeMirror: Groovy mode

- -
- - - -

MIME types defined: text/x-groovy

- - diff --git a/app/assets/mode/haskell/index.html b/app/assets/mode/haskell/index.html deleted file mode 100644 index 15706e710..000000000 --- a/app/assets/mode/haskell/index.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - CodeMirror: Haskell mode - - - - - - - - -

CodeMirror: Haskell mode

- -
- - - -

MIME types defined: text/x-haskell.

- - diff --git a/app/assets/mode/haxe/index.html b/app/assets/mode/haxe/index.html deleted file mode 100644 index 6e9948a0b..000000000 --- a/app/assets/mode/haxe/index.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - CodeMirror: Haxe mode - - - - - - - -

CodeMirror: Haxe mode

- -
- - - -

MIME types defined: text/x-haxe.

- - diff --git a/app/assets/mode/htmlembedded/index.html b/app/assets/mode/htmlembedded/index.html deleted file mode 100644 index c1374e58c..000000000 --- a/app/assets/mode/htmlembedded/index.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - CodeMirror: Html Embedded Scripts mode - - - - - - - - - - - -

CodeMirror: Html Embedded Scripts mode

- -
- - - -

Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on - JavaScript, CSS and XML.
Other dependancies include those of the scriping language chosen.

- -

MIME types defined: application/x-aspx (ASP.NET), - application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

- - diff --git a/app/assets/mode/htmlmixed/index.html b/app/assets/mode/htmlmixed/index.html deleted file mode 100644 index 63fc41209..000000000 --- a/app/assets/mode/htmlmixed/index.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - CodeMirror: HTML mixed mode - - - - - - - - - - -

CodeMirror: HTML mixed mode

-
- - -

The HTML mixed mode depends on the XML, JavaScript, and CSS modes.

- -

MIME types defined: text/html - (redefined, only takes effect if you load this parser after the - XML parser).

- - - diff --git a/app/assets/mode/javascript/index.html b/app/assets/mode/javascript/index.html deleted file mode 100644 index c3ab91dc6..000000000 --- a/app/assets/mode/javascript/index.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - CodeMirror: JavaScript mode - - - - - - - -

CodeMirror: JavaScript mode

- -
- - - -

JavaScript mode supports a single configuration - option, json, which will set the mode to expect JSON - data rather than a JavaScript program.

- -

MIME types defined: text/javascript, application/json.

- - diff --git a/app/assets/mode/jinja2/index.html b/app/assets/mode/jinja2/index.html deleted file mode 100644 index 021a2829a..000000000 --- a/app/assets/mode/jinja2/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - CodeMirror: Jinja2 mode - - - - - - - -

CodeMirror: Jinja2 mode

-
- - - diff --git a/app/assets/mode/less/index.html b/app/assets/mode/less/index.html deleted file mode 100644 index cad8e4b22..000000000 --- a/app/assets/mode/less/index.html +++ /dev/null @@ -1,618 +0,0 @@ - - - - CodeMirror: LESS mode - - - - - - - - - -

CodeMirror: LESS mode

-
- - -

MIME types defined: text/x-less, text/css (if not previously defined).

- - diff --git a/app/assets/mode/lua/index.html b/app/assets/mode/lua/index.html deleted file mode 100644 index 600ddb0e4..000000000 --- a/app/assets/mode/lua/index.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - CodeMirror: Lua mode - - - - - - - - -

CodeMirror: Lua mode

-
- - -

Loosely based on Franciszek - Wawrzak's CodeMirror - 1 mode. One configuration parameter is - supported, specials, to which you can provide an - array of strings to have those identifiers highlighted with - the lua-special style.

-

MIME types defined: text/x-lua.

- - - diff --git a/app/assets/mode/markdown/index.html b/app/assets/mode/markdown/index.html deleted file mode 100644 index c8791a702..000000000 --- a/app/assets/mode/markdown/index.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - CodeMirror: Markdown mode - - - - - - - - -

CodeMirror: Markdown mode

- - -
- - - -

Optionally depends on the XML mode for properly highlighted inline XML blocks.

- -

MIME types defined: text/x-markdown.

- - - diff --git a/app/assets/mode/mysql/index.html b/app/assets/mode/mysql/index.html deleted file mode 100644 index 006918c0c..000000000 --- a/app/assets/mode/mysql/index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - CodeMirror: MySQL mode - - - - - - - -

CodeMirror: MySQL mode

-
- - -

MIME types defined: text/x-mysql.

- - - diff --git a/app/assets/mode/ntriples/index.html b/app/assets/mode/ntriples/index.html deleted file mode 100644 index 08d33babb..000000000 --- a/app/assets/mode/ntriples/index.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - CodeMirror: NTriples mode - - - - - - - -

CodeMirror: NTriples mode

-
- -
- - -

MIME types defined: text/n-triples.

- - diff --git a/app/assets/mode/ocaml/index.html b/app/assets/mode/ocaml/index.html deleted file mode 100644 index d286edc17..000000000 --- a/app/assets/mode/ocaml/index.html +++ /dev/null @@ -1,130 +0,0 @@ - - -CodeMirror: OCaml mode - - - - - - - - - -

CodeMirror: OCaml mode

- - - - - -

MIME types defined: text/x-ocaml.

diff --git a/app/assets/mode/pascal/index.html b/app/assets/mode/pascal/index.html deleted file mode 100644 index 6af6b460e..000000000 --- a/app/assets/mode/pascal/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - CodeMirror: Pascal mode - - - - - - - -

CodeMirror: Pascal mode

- -
- - - -

MIME types defined: text/x-pascal.

- - diff --git a/app/assets/mode/perl/index.html b/app/assets/mode/perl/index.html deleted file mode 100644 index 5ef55d323..000000000 --- a/app/assets/mode/perl/index.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - CodeMirror: Perl mode - - - - - - - -

CodeMirror: Perl mode

- -
- - - -

MIME types defined: text/x-perl.

- - diff --git a/app/assets/mode/php/index.html b/app/assets/mode/php/index.html deleted file mode 100644 index 7949044e6..000000000 --- a/app/assets/mode/php/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - CodeMirror: PHP mode - - - - - - - - - - - -

CodeMirror: PHP mode

- -
- - - -

Simple HTML/PHP mode based on - the C-like mode. Depends on XML, - JavaScript, CSS, and C-like modes.

- -

MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

- - diff --git a/app/assets/mode/pig/index.html b/app/assets/mode/pig/index.html deleted file mode 100644 index 9cd69c4f6..000000000 --- a/app/assets/mode/pig/index.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - CodeMirror: Pig Latin mode - - - - - - - -

CodeMirror: Pig Latin mode

- -
- - - -

- Simple mode that handles Pig Latin language. -

- -

MIME type defined: text/x-pig - (PIG code) - diff --git a/app/assets/mode/plsql/index.html b/app/assets/mode/plsql/index.html deleted file mode 100644 index be603d990..000000000 --- a/app/assets/mode/plsql/index.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - CodeMirror: Oracle PL/SQL mode - - - - - - - -

CodeMirror: Oracle PL/SQL mode

- -
- - - -

- Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course). -

- -

MIME type defined: text/x-plsql - (PLSQL code) - diff --git a/app/assets/mode/properties/index.html b/app/assets/mode/properties/index.html deleted file mode 100755 index 4f0c269cd..000000000 --- a/app/assets/mode/properties/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - CodeMirror: Properties files mode - - - - - - - -

CodeMirror: Properties files mode

-
- - -

MIME types defined: text/x-properties, - text/x-ini.

- - - diff --git a/app/assets/mode/python/index.html b/app/assets/mode/python/index.html deleted file mode 100644 index 47e0e9d07..000000000 --- a/app/assets/mode/python/index.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - CodeMirror: Python mode - - - - - - - -

CodeMirror: Python mode

- -
- -

Configuration Options:

-
    -
  • version - 2/3 - The version of Python to recognize. Default is 2.
  • -
  • singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.
  • -
- -

MIME types defined: text/x-python.

- - diff --git a/app/assets/mode/r/index.html b/app/assets/mode/r/index.html deleted file mode 100644 index 69775055d..000000000 --- a/app/assets/mode/r/index.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - CodeMirror: R mode - - - - - - - -

CodeMirror: R mode

-
- - -

MIME types defined: text/x-rsrc.

- -

Development of the CodeMirror R mode was kindly sponsored - by Ubalo, who hold - the license.

- - - diff --git a/app/assets/mode/rpm/changes/index.html b/app/assets/mode/rpm/changes/index.html deleted file mode 100644 index b7ff952d8..000000000 --- a/app/assets/mode/rpm/changes/index.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - CodeMirror: RPM changes mode - - - - - - - -

CodeMirror: RPM changes mode

- -
- - -

MIME types defined: text/x-rpm-changes.

- - diff --git a/app/assets/mode/rpm/spec/index.html b/app/assets/mode/rpm/spec/index.html deleted file mode 100644 index e3bca1521..000000000 --- a/app/assets/mode/rpm/spec/index.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - CodeMirror: RPM spec mode - - - - - - - - -

CodeMirror: RPM spec mode

- -
- - -

MIME types defined: text/x-rpm-spec.

- - diff --git a/app/assets/mode/rst/index.html b/app/assets/mode/rst/index.html deleted file mode 100644 index fd75a284c..000000000 --- a/app/assets/mode/rst/index.html +++ /dev/null @@ -1,525 +0,0 @@ - - - - CodeMirror: reStructuredText mode - - - - - - - -

CodeMirror: reStructuredText mode

- -
- - -

The reStructuredText mode supports one configuration parameter:

-
-
verbatim (string)
-
A name or MIME type of a mode that will be used for highlighting - verbatim blocks. By default, reStructuredText mode uses uniform color - for whole block of verbatim text if no mode is given.
-
-

If python mode is available, - it will be used for highlighting blocks containing Python/IPython terminal - sessions (blocks starting with >>> (for Python) or - In [num]: (for IPython). - -

MIME types defined: text/x-rst.

- - - diff --git a/app/assets/mode/ruby/index.html b/app/assets/mode/ruby/index.html deleted file mode 100644 index 6d33db192..000000000 --- a/app/assets/mode/ruby/index.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - CodeMirror: Ruby mode - - - - - - - -

CodeMirror: Ruby mode

-
- - -

MIME types defined: text/x-ruby.

- -

Development of the CodeMirror Ruby mode was kindly sponsored - by Ubalo, who hold - the license.

- - - diff --git a/app/assets/mode/rust/index.html b/app/assets/mode/rust/index.html deleted file mode 100644 index 3b811e35d..000000000 --- a/app/assets/mode/rust/index.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - CodeMirror: Rust mode - - - - - - - -

CodeMirror: Rust mode

- -
- - - -

MIME types defined: text/x-rustsrc.

- - diff --git a/app/assets/mode/scheme/index.html b/app/assets/mode/scheme/index.html deleted file mode 100644 index 2a6105fa9..000000000 --- a/app/assets/mode/scheme/index.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - CodeMirror: Scheme mode - - - - - - - -

CodeMirror: Scheme mode

-
- - -

MIME types defined: text/x-scheme.

- - - diff --git a/app/assets/mode/shell/index.html b/app/assets/mode/shell/index.html deleted file mode 100644 index 2d6d08472..000000000 --- a/app/assets/mode/shell/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - -CodeMirror: Shell mode - - - - - - - - - -

CodeMirror: Shell mode

- - - - - -

MIME types defined: text/x-sh.

diff --git a/app/assets/mode/smalltalk/index.html b/app/assets/mode/smalltalk/index.html deleted file mode 100644 index 8a85c39ee..000000000 --- a/app/assets/mode/smalltalk/index.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - CodeMirror: Smalltalk mode - - - - - - - -

CodeMirror: Smalltalk mode

- -
- - - -

Simple Smalltalk mode.

- -

MIME types defined: text/x-stsrc.

- - diff --git a/app/assets/mode/smarty/index.html b/app/assets/mode/smarty/index.html deleted file mode 100644 index ad4dccf03..000000000 --- a/app/assets/mode/smarty/index.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - CodeMirror: Smarty mode - - - - - - - -

CodeMirror: Smarty mode

- -
- - - -
- -
- - - -

A plain text/Smarty mode which allows for custom delimiter tags (defaults to { and }).

- -

MIME types defined: text/x-smarty

- - diff --git a/app/assets/mode/sparql/index.html b/app/assets/mode/sparql/index.html deleted file mode 100644 index d7772f6bc..000000000 --- a/app/assets/mode/sparql/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - CodeMirror: SPARQL mode - - - - - - - -

CodeMirror: SPARQL mode

-
- - -

MIME types defined: application/x-sparql-query.

- - - diff --git a/app/assets/mode/stex/index.html b/app/assets/mode/stex/index.html deleted file mode 100644 index e49289e9d..000000000 --- a/app/assets/mode/stex/index.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - CodeMirror: sTeX mode - - - - - - - -

CodeMirror: sTeX mode

-
- - -

MIME types defined: text/x-stex.

- - - diff --git a/app/assets/mode/stex/test.html b/app/assets/mode/stex/test.html deleted file mode 100644 index a60f41848..000000000 --- a/app/assets/mode/stex/test.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - CodeMirror: sTeX mode - - - - - - - - -

Tests for the sTeX Mode

-

Basics

- - -

Tags

- - -

Comments

- - -

Errors

- - -

Character Escapes

- - -

Spacing control

- - - -

New Commands

- - Should be able to define a new command that happens to be a method on Array - (e.g. pop): - - -

Summary

- - - - - diff --git a/app/assets/mode/tiddlywiki/index.html b/app/assets/mode/tiddlywiki/index.html deleted file mode 100644 index 2f7da0e06..000000000 --- a/app/assets/mode/tiddlywiki/index.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - CodeMirror: TiddlyWiki mode - - - - - - - - -

CodeMirror: TiddlyWiki mode

- -
- - - -

TiddlyWiki mode supports a single configuration.

- -

MIME types defined: text/x-tiddlywiki.

- - diff --git a/app/assets/mode/tiki/index.html b/app/assets/mode/tiki/index.html deleted file mode 100644 index bf800407a..000000000 --- a/app/assets/mode/tiki/index.html +++ /dev/null @@ -1,82 +0,0 @@ - - - CodeMirror: Tiki wiki mode - - - - - - - - -

CodeMirror: Tiki wiki mode

- -
- - - - - diff --git a/app/assets/mode/vb/index.html b/app/assets/mode/vb/index.html deleted file mode 100644 index 7c42be493..000000000 --- a/app/assets/mode/vb/index.html +++ /dev/null @@ -1,88 +0,0 @@ - - - CodeMirror: VB.NET mode - - - - - - - - - -

CodeMirror: VB.NET mode

- - - -
- -
-

-  

MIME type defined: text/x-vb.

- - diff --git a/app/assets/mode/vbscript/index.html b/app/assets/mode/vbscript/index.html deleted file mode 100644 index dd207cae9..000000000 --- a/app/assets/mode/vbscript/index.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - CodeMirror: VBScript mode - - - - - - - -

CodeMirror: VBScript mode

- -
- - - -

MIME types defined: text/vbscript.

- - - diff --git a/app/assets/mode/velocity/index.html b/app/assets/mode/velocity/index.html deleted file mode 100644 index 49dba3820..000000000 --- a/app/assets/mode/velocity/index.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - CodeMirror: Velocity mode - - - - - - - - -

CodeMirror: Velocity mode

-
- - -

MIME types defined: text/velocity.

- - - diff --git a/app/assets/mode/verilog/index.html b/app/assets/mode/verilog/index.html deleted file mode 100644 index 775dd5374..000000000 --- a/app/assets/mode/verilog/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - CodeMirror: Verilog mode - - - - - - - -

CodeMirror: Verilog mode

- -
- - - -

Simple mode that tries to handle Verilog-like languages as well as it - can. Takes one configuration parameters: keywords, an - object whose property names are the keywords in the language.

- -

MIME types defined: text/x-verilog (Verilog code).

- - diff --git a/app/assets/mode/xml/index.html b/app/assets/mode/xml/index.html deleted file mode 100644 index 3b6d6af1e..000000000 --- a/app/assets/mode/xml/index.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - CodeMirror: XML mode - - - - - - - -

CodeMirror: XML mode

-
- -

The XML mode supports two configuration parameters:

-
-
htmlMode (boolean)
-
This switches the mode to parse HTML instead of XML. This - means attributes do not have to be quoted, and some elements - (such as br) do not require a closing tag.
-
alignCDATA (boolean)
-
Setting this to true will force the opening tag of CDATA - blocks to not be indented.
-
- -

MIME types defined: application/xml, text/html.

- - diff --git a/app/assets/mode/xquery/index.html b/app/assets/mode/xquery/index.html deleted file mode 100644 index 82f00d247..000000000 --- a/app/assets/mode/xquery/index.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - CodeMirror 2: JavaScript mode - - - - - - - - -

CodeMirror 2: XQuery mode

- -
- -
- - - -

MIME types defined: application/xquery.

- -

Development of the CodeMirror XQuery mode was sponsored by - MarkLogic and developed by - Mike Brevoort. -

- - - diff --git a/app/assets/mode/xquery/test/index.html b/app/assets/mode/xquery/test/index.html deleted file mode 100644 index ba82e54f3..000000000 --- a/app/assets/mode/xquery/test/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - -

XQuery CodeMirror Mode

-

-

-
    -
-
- - diff --git a/app/assets/mode/yaml/index.html b/app/assets/mode/yaml/index.html deleted file mode 100644 index 7f2c7929a..000000000 --- a/app/assets/mode/yaml/index.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - CodeMirror: YAML mode - - - - - - - -

CodeMirror: YAML mode

-
- - -

MIME types defined: text/x-yaml.

- - - From 6ad8caab77b67bef886024de5e7daad6ba979065 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 Oct 2012 15:57:00 -0700 Subject: [PATCH 0031/1055] Allocate new String for name and content This is required on Android 2.2 to the values passed to CodeMirror are of the JavaScript String type. Closes #256 --- app/assets/source-editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/source-editor.js b/app/assets/source-editor.js index 13bf8540a..2c21b4d69 100644 --- a/app/assets/source-editor.js +++ b/app/assets/source-editor.js @@ -139,7 +139,7 @@ function loadImage(type, content) { } function loadEditor() { - var name = SourceEditor.getName(); + var name = new String(SourceEditor.getName()); var extension = getExtension(name); if ("png" == extension || "gif" == extension) { loadImage(extension, SourceEditor.getRawContent()); @@ -152,7 +152,7 @@ function loadEditor() { CodeMirror.modeURL = "mode/%N/%N.js"; var config = {}; - config.value = SourceEditor.getContent(); + config.value = new String(SourceEditor.getContent()); config.readOnly = "nocursor"; config.lineNumbers = true; config.autofocus = false; From f9df76d1bd9f60669c750d0cbcc9a49bfe75c3f2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 23 Oct 2012 08:32:36 -0700 Subject: [PATCH 0032/1055] Cast null to remove ambiguous call Closes #261 --- .../main/java/com/github/mobile/tests/ref/RefUtilsTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/src/main/java/com/github/mobile/tests/ref/RefUtilsTest.java b/integration-tests/src/main/java/com/github/mobile/tests/ref/RefUtilsTest.java index 77f50f34d..f5931e121 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/ref/RefUtilsTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/ref/RefUtilsTest.java @@ -43,7 +43,7 @@ public void testIsBranch() { * Verify {@link RefUtils#isTag(org.eclipse.egit.github.core.Reference)} */ public void testIsTag() { - assertFalse(RefUtils.isTag(null)); + assertFalse(RefUtils.isTag((Reference) null)); assertFalse(RefUtils.isTag(new Reference())); assertFalse(RefUtils.isTag(new Reference().setRef(""))); assertFalse(RefUtils.isTag(new Reference().setRef("test"))); @@ -72,7 +72,7 @@ public void testIsValid() { * Verify {@link RefUtils#getName(Reference)} */ public void testGetName() { - assertNull(RefUtils.getName(null)); + assertNull(RefUtils.getName((Reference) null)); assertNull(RefUtils.getName(new Reference())); assertEquals("", RefUtils.getName(new Reference().setRef(""))); assertEquals("unchanged", From 7f14451d165e6e1af9c97edf3e712ae480ccaf5a Mon Sep 17 00:00:00 2001 From: Johannes Schleifenbaum Date: Tue, 23 Oct 2012 08:37:14 -0700 Subject: [PATCH 0033/1055] Add German translation of comment preview and markdown error Closes #260 --- app/res/values-de/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/res/values-de/strings.xml b/app/res/values-de/strings.xml index 861bcabc0..0a930c48c 100644 --- a/app/res/values-de/strings.xml +++ b/app/res/values-de/strings.xml @@ -45,6 +45,7 @@ Favorisieren fehlgeschlagen Entfernen des Favoriten fehlgeschlagen Prüfen des Favoritenstatus fehlgeschlagen + Rendern der Markdown-Vorschau fehlgeschlagen @@ -252,5 +253,7 @@ Teilen Passwort anzeigen + Schreiben + Vorschau From 72fe419625428f90d644ddf324753b6ece67e201 Mon Sep 17 00:00:00 2001 From: Chiara De Liberato Date: Fri, 19 Oct 2012 23:15:08 +0300 Subject: [PATCH 0034/1055] Update italian translation Closes #259 --- app/res/values-it/strings.xml | 54 +++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/app/res/values-it/strings.xml b/app/res/values-it/strings.xml index 70158e739..d1730c9b0 100644 --- a/app/res/values-it/strings.xml +++ b/app/res/values-it/strings.xml @@ -13,6 +13,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + + ***************************************************** + Italian Translation by Chiara De Liberato + WebSite: http://www.chiaradeliberato.it/ + GitHub: https://github.com/Chiara-De-Liberato/ + ***************************************************** + --> @@ -37,6 +44,14 @@ Impossibile caricare i Commits Impossibile caricare il Commit Impossibile caricare il file + Impossibile caricare il codice + Impossibile caricare branch e tag + Impossibile aggiungere la persona + Impossibile eliminare la persona + Impossibile controllare following + Impossibile aggiungere tra i preferiti + Impossibile eliminare dai preferiti + Impossibile controllare preferiti @@ -57,6 +72,7 @@ Etichette in caricamento… Commits in caricamento… Files e commenti in caricamento… + Branch e tag in caricamento @@ -102,10 +118,6 @@ File Apri Random - Nome del File - Contenuto del File - Nuovo Gist - Filtro Segnalibro Commento Cancella @@ -130,14 +142,13 @@ Gist creato in Android Titolo Modifica - Preferiti Inserimento Gist tra i preferiti… - Togli dai preferiti Rimozione del Gist dai preferiti in corso… Account Seleziona Assegnatario Seleziona Milestone Seleziona Etichette + Select Branch or Tag Nessun milestone Non ci sono assegnatari E\' assegnatario @@ -171,6 +182,10 @@ Following Followers Following + Follow + Unfollow + Aggiungi ai preferiti + Elimina dai preferiti Membri Chiusura Notifica in corso… Riapertura Notifica in corso… @@ -215,5 +230,32 @@ Confronta {0} commits Abilita il wrapping Disabilita il wrapping + Codice + Caricamento tra i following... + Cancellazione dai following... + Caricamento tra i preferiti... + Cancellazione dai preferiti... + + + Repository + news + following + followers + following + followers + membri + codice + commits + segnalazioni + osservati + assegnati + creati + menzionati + miei + preferiti + tutti + + Condividi + Mostra password From 4c1446542549e6101adb4a732442d578cce9962e Mon Sep 17 00:00:00 2001 From: Erkan Date: Wed, 24 Oct 2012 19:17:27 +0300 Subject: [PATCH 0035/1055] Update french translation Closes #262 --- app/res/values-fr/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/res/values-fr/strings.xml b/app/res/values-fr/strings.xml index 83b73877e..5adbc11ca 100644 --- a/app/res/values-fr/strings.xml +++ b/app/res/values-fr/strings.xml @@ -45,6 +45,7 @@ Erreur lors de l\'ajout aux favoris Erreur lors de la suppression des favoris Erreur lors de la vérification du favoris + Erreur lors du rendu du markdown @@ -254,4 +255,6 @@ Partager Voir mot de passe + Ecrire + Pré-visualiser From b330857ba1b2f6d2b882806aedb7dec0eb2da518 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Fri, 26 Oct 2012 10:34:14 +0300 Subject: [PATCH 0036/1055] Update Ukrainian translations New strings added and some long words replaced with shorter. Closes #264 --- app/res/values-uk/strings.xml | 41 +++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/app/res/values-uk/strings.xml b/app/res/values-uk/strings.xml index 1f4890d45..ab9accf24 100644 --- a/app/res/values-uk/strings.xml +++ b/app/res/values-uk/strings.xml @@ -23,13 +23,13 @@ Помилка при завантаженні репозиторія Помилка при завантаженні Gist Помилка при завантаженні новин - Помилка при завантаженні послідовників + Помилка при завантаженні читачів Помилка при завантаженні профілів Помилка при завантаженні профіля Помилка при завантаженні вмісту Gist файла Помилка при завантаженні Gist-ів Помилка при завантаженні задачі - Помилка при завантаженні співучасників + Помилка при завантаженні учасників Помилка при завантаженні етапів Помилка при завантаженні тегів Помилка при завантаженні закладок @@ -39,6 +39,13 @@ Помилка при завантаженні файла Помилка при завантаженні коду Помилка при завантаженні гілок та тегів + Помилка при підписці + Помилка при відписці + Помилка при перевірці підписки + Помилка при додаванні до улюблених + Помилка при видаленні із улюблених + Помилка при перевірці статуса + Помилка при рендерингу markdown @@ -51,10 +58,10 @@ Завантаження репозиторіїв… Завантаження задачі… Завантаження новин… - Завантаження послідовників… + Завантаження читачів… Завантаження профілів… Завантаження Gist-ів… - Завантаження співучасників… + Завантаження учасників… Завантаження етапів… Завантаження тегів… Завантаження комітів… @@ -69,7 +76,7 @@ Немає завдань Немає Gist-ів Немає профілів - Немає послідовників + Немає читачів Немає учасників Немає новин Немає комітів @@ -133,9 +140,7 @@ Gist створений на Android Заголовок Редагувати - Додати до улюблених Відмічаємо Gist як улюблений… - Видалити із улюблених Видалення Gist із улюблених… Профілі Відповідальний @@ -171,10 +176,14 @@ Введіть правильний пароль. Пароль Логін або пошта - Послідовники + Читачі Підписки - Послідовники + Читачі Підписки + Підписатись + Відписатись + Додати до улюблених + Видалити із улюблених Учасники Закриття завдання… Відкриття завдання… @@ -220,25 +229,33 @@ Увімкнути перенесення рядків Вимкнути перенесення рядків Код + Підписка… + Відписка… + Додавання до улюблених… + Видалення із улюблених… репозиторії новини підписки - послідовники + читачі підписки - послідовники + читачі учасники код коміти завдання слідкую - відповідальний + призначені створені згаданий мої улюблені всі + Поділитись + Показати пароль + Написати + Переглянути From 206fe02c32ecc9cce1f3c60074aad820da3da0b8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 26 Oct 2012 09:57:54 -0700 Subject: [PATCH 0037/1055] Ignore scroll event if not attached to activity 2 crashes were reported for requesting the LoaderManager here when the fragment was not attached to an Activity --- app/src/main/java/com/github/mobile/ui/PagedItemFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/com/github/mobile/ui/PagedItemFragment.java b/app/src/main/java/com/github/mobile/ui/PagedItemFragment.java index 3b31e69d7..298ebae6c 100644 --- a/app/src/main/java/com/github/mobile/ui/PagedItemFragment.java +++ b/app/src/main/java/com/github/mobile/ui/PagedItemFragment.java @@ -106,6 +106,8 @@ public void onScrollStateChanged(AbsListView view, int scrollState) { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { + if (!isUsable()) + return; if (!pager.hasMore()) return; if (getLoaderManager().hasRunningLoaders()) From 11e96c21b0391ec67d8e8b85b9dd405faed7a89f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 29 Oct 2012 12:06:49 -0700 Subject: [PATCH 0038/1055] Treat '.gyp' files as JSON --- app/assets/source-editor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/source-editor.js b/app/assets/source-editor.js index 2c21b4d69..cd6530cf3 100644 --- a/app/assets/source-editor.js +++ b/app/assets/source-editor.js @@ -64,6 +64,7 @@ function getMode(extension) { mode.mode = "text/x-java"; mode.file = "clike"; break; + case "gyp": case "js": case "json": mode.mode = "text/javascript"; From 703c7964beb423b58b1a74878f2667c8bdde46a1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 29 Oct 2012 12:08:00 -0700 Subject: [PATCH 0039/1055] Register loadEditor as window.onload function --- app/assets/source-editor.html | 2 +- app/assets/source-editor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/source-editor.html b/app/assets/source-editor.html index fe8c2e737..d53d1bbf1 100644 --- a/app/assets/source-editor.html +++ b/app/assets/source-editor.html @@ -7,6 +7,6 @@ - + \ No newline at end of file diff --git a/app/assets/source-editor.js b/app/assets/source-editor.js index cd6530cf3..374eb8955 100644 --- a/app/assets/source-editor.js +++ b/app/assets/source-editor.js @@ -139,7 +139,7 @@ function loadImage(type, content) { document.body.appendChild(img); } -function loadEditor() { +window.onload = function() { var name = new String(SourceEditor.getName()); var extension = getExtension(name); if ("png" == extension || "gif" == extension) { From c0084cb6773d670874a6fb045bede2fc57ed1636 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 31 Oct 2012 10:24:21 -0700 Subject: [PATCH 0040/1055] Add missing override annotation --- app/src/main/java/com/github/mobile/ui/PagerActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/ui/PagerActivity.java b/app/src/main/java/com/github/mobile/ui/PagerActivity.java index 317f4ac37..d89459b0f 100644 --- a/app/src/main/java/com/github/mobile/ui/PagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/PagerActivity.java @@ -87,6 +87,7 @@ public void onPageSelected(int position) { invalidateOptionsMenu(); } + @Override public void onPageScrollStateChanged(int state) { // Intentionally left blank } From 4586cb3161bf38c5e2c78ed619767a711306491e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 1 Nov 2012 10:18:16 -0700 Subject: [PATCH 0041/1055] Ignore item clicks if entry or tree is null --- .../java/com/github/mobile/ui/code/RepositoryCodeFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java index d2efc3cfb..e4202f873 100644 --- a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java +++ b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java @@ -311,6 +311,9 @@ public void onClick(View v) { public void onItemClick(AdapterView parent, View view, int position, long id) { Entry entry = (Entry) parent.getItemAtPosition(position); + if (tree == null || entry == null) + return; + if (entry instanceof Folder) setFolder(tree, (Folder) entry); else From f6737b81ef6a62acad953d56029e6e0baafd1121 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Sat, 3 Nov 2012 19:19:22 -0700 Subject: [PATCH 0042/1055] Log when auth token is requested --- .../java/com/github/mobile/accounts/AccountAuthenticator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java index cc3c5190f..70c0fd7ed 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java @@ -155,6 +155,7 @@ private String createAuthorization(OAuthService service, List scopes) public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { + Log.d(TAG, "Retrieving OAuth2 token"); final Bundle bundle = new Bundle(); From 082a39d18aed3d7baf994570cf8519b58d10bc11 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 8 Nov 2012 09:43:46 +0100 Subject: [PATCH 0043/1055] Remove unneeded {} --- .../java/com/github/mobile/persistence/DatabaseCache.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/persistence/DatabaseCache.java b/app/src/main/java/com/github/mobile/persistence/DatabaseCache.java index 271549223..97257ecd6 100644 --- a/app/src/main/java/com/github/mobile/persistence/DatabaseCache.java +++ b/app/src/main/java/com/github/mobile/persistence/DatabaseCache.java @@ -148,9 +148,9 @@ private List loadFromDB(final SQLiteOpenHelper helper, return null; List cached = new ArrayList(); - do { + do cached.add(persistableResource.loadFrom(cursor)); - } while (cursor.moveToNext()); + while (cursor.moveToNext()); return cached; } finally { cursor.close(); From 2e801599338cb29e6c114daf44fd85dd7d3574b9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 8 Nov 2012 09:50:50 +0100 Subject: [PATCH 0044/1055] Remove ellipsis from log message --- app/src/main/java/com/github/mobile/sync/SyncCampaign.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/sync/SyncCampaign.java b/app/src/main/java/com/github/mobile/sync/SyncCampaign.java index 40f4a46b3..8ee3bd613 100644 --- a/app/src/main/java/com/github/mobile/sync/SyncCampaign.java +++ b/app/src/main/java/com/github/mobile/sync/SyncCampaign.java @@ -94,7 +94,7 @@ public void run() { if (cancelled) return; - Log.d(TAG, "Syncing repos for " + org.getLogin() + "..."); + Log.d(TAG, "Syncing repos for " + org.getLogin()); try { cache.requestAndStore(repos.under(org)); syncResult.stats.numUpdates++; From a541e9124d880d2e307f99c830fde720ef0a1a2e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 14 Nov 2012 15:55:43 -0800 Subject: [PATCH 0045/1055] Import layout class from com.github.mobile package Closes #270 --- app/src/main/java/com/github/mobile/ui/TabPagerActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index 6acadc2b5..563701268 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -30,8 +30,8 @@ import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.drawable; import com.github.mobile.R.id; +import com.github.mobile.R.layout; import com.github.mobile.util.TypefaceUtils; -import com.viewpagerindicator.R.layout; /** * Actiivty with tabbed pages From 3bf67870bdb6c0b0ad6d7d1fe2341978f31525ad Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 14 Nov 2012 15:55:56 -0800 Subject: [PATCH 0046/1055] Correct typo in class header comment --- app/src/main/java/com/github/mobile/ui/TabPagerActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index 563701268..8b4cbe814 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -34,7 +34,7 @@ import com.github.mobile.util.TypefaceUtils; /** - * Actiivty with tabbed pages + * Activity with tabbed pages * * @param */ From bd4e6fb6ab4c3e63ea5c2790cd3b19e4342ec4f4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 05:04:46 -0800 Subject: [PATCH 0047/1055] Update R sub-class imports to all be from app package Closes #270 --- .../java/com/github/mobile/ui/commit/CommitFileListAdapter.java | 2 +- .../main/java/com/github/mobile/ui/issue/IssuesFragment.java | 2 +- .../main/java/com/github/mobile/ui/issue/LabelDrawableSpan.java | 2 +- .../com/github/mobile/ui/repo/DefaultRepositoryListAdapter.java | 2 +- .../com/github/mobile/ui/repo/UserRepositoryListAdapter.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java b/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java index 128903a09..e02bc489a 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java @@ -19,9 +19,9 @@ import android.text.TextUtils; import android.view.LayoutInflater; -import com.actionbarsherlock.R.color; import com.github.kevinsawicki.wishlist.MultiTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; +import com.github.mobile.R.color; import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.core.commit.FullCommitFile; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java index 8985c863f..d89af43ab 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java @@ -32,13 +32,13 @@ import android.widget.ListView; import android.widget.TextView; -import com.actionbarsherlock.R.menu; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.mobile.R.id; import com.github.mobile.R.layout; +import com.github.mobile.R.menu; import com.github.mobile.R.string; import com.github.mobile.RequestFuture; import com.github.mobile.core.ResourcePager; diff --git a/app/src/main/java/com/github/mobile/ui/issue/LabelDrawableSpan.java b/app/src/main/java/com/github/mobile/ui/issue/LabelDrawableSpan.java index 88610d18e..f68066ab9 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/LabelDrawableSpan.java +++ b/app/src/main/java/com/github/mobile/ui/issue/LabelDrawableSpan.java @@ -32,7 +32,7 @@ import android.text.style.DynamicDrawableSpan; import android.widget.TextView; -import com.actionbarsherlock.R.drawable; +import com.github.mobile.R.drawable; import com.github.mobile.R.id; import com.github.mobile.ui.StyledText; import com.github.mobile.util.ServiceUtils; diff --git a/app/src/main/java/com/github/mobile/ui/repo/DefaultRepositoryListAdapter.java b/app/src/main/java/com/github/mobile/ui/repo/DefaultRepositoryListAdapter.java index 5d18cfdd8..9062afbaa 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/DefaultRepositoryListAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/repo/DefaultRepositoryListAdapter.java @@ -19,7 +19,7 @@ import android.view.View; import android.widget.TextView; -import com.actionbarsherlock.R.color; +import com.github.mobile.R.color; import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.ui.StyledText; diff --git a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListAdapter.java b/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListAdapter.java index c729d1025..d761892fc 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListAdapter.java @@ -19,7 +19,7 @@ import android.view.View; import android.widget.TextView; -import com.actionbarsherlock.R.color; +import com.github.mobile.R.color; import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.ui.StyledText; From e1abf01ad72d72bde4aabfa67eb68bdfc5aabea1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 08:58:08 -0800 Subject: [PATCH 0048/1055] Upgrade to CodeMirror 2.3.5 Close #268 --- app/assets/VERSION-code-mirror | 1 + app/assets/lib/codemirror.css | 29 +- app/assets/lib/codemirror.js | 1532 ++++++++--------- app/assets/lib/util/loadmode.js | 2 +- app/assets/lib/util/multiplex.js | 14 +- app/assets/lib/util/overlay.js | 9 +- app/assets/lib/util/runmode.js | 12 +- app/assets/mode/clike/clike.js | 9 +- app/assets/mode/clojure/clojure.js | 17 +- app/assets/mode/coffeescript/coffeescript.js | 6 +- app/assets/mode/commonlisp/commonlisp.js | 101 ++ app/assets/mode/css/css.js | 354 +++- app/assets/mode/ecl/ecl.js | 2 +- app/assets/mode/gfm/gfm.js | 220 +-- app/assets/mode/go/go.js | 4 +- app/assets/mode/groovy/groovy.js | 2 +- app/assets/mode/haskell/haskell.js | 4 +- app/assets/mode/haxe/haxe.js | 11 +- app/assets/mode/htmlembedded/htmlembedded.js | 13 +- app/assets/mode/htmlmixed/htmlmixed.js | 25 +- app/assets/mode/javascript/javascript.js | 84 +- app/assets/mode/less/less.js | 154 +- app/assets/mode/lua/lua.js | 2 +- app/assets/mode/markdown/markdown.js | 289 +++- app/assets/mode/ntriples/ntriples.js | 8 +- app/assets/mode/ocaml/ocaml.js | 2 +- app/assets/mode/pascal/pascal.js | 2 +- app/assets/mode/perl/perl.js | 142 +- app/assets/mode/php/php.js | 16 +- app/assets/mode/pig/pig.js | 6 +- app/assets/mode/properties/properties.js | 0 app/assets/mode/python/python.js | 2 +- app/assets/mode/scheme/scheme.js | 2 +- app/assets/mode/shell/shell.js | 4 +- app/assets/mode/sieve/LICENSE | 23 + app/assets/mode/sieve/sieve.js | 156 ++ app/assets/mode/smalltalk/smalltalk.js | 4 +- app/assets/mode/smarty/smarty.js | 4 +- app/assets/mode/stex/stex.js | 2 +- app/assets/mode/tiki/tiki.js | 15 +- app/assets/mode/vb/vb.js | 4 +- app/assets/mode/velocity/velocity.js | 2 +- app/assets/mode/verilog/verilog.js | 2 +- app/assets/mode/xml/xml.js | 12 +- app/assets/mode/xquery/test/testBase.js | 42 - .../xquery/test/testEmptySequenceKeyword.js | 16 - app/assets/mode/xquery/test/testMultiAttr.js | 16 - app/assets/mode/xquery/test/testNamespaces.js | 91 - .../xquery/test/testProcessingInstructions.js | 16 - app/assets/mode/xquery/test/testQuotes.js | 19 - app/assets/mode/xquery/xquery.js | 11 +- 51 files changed, 2051 insertions(+), 1464 deletions(-) create mode 100644 app/assets/VERSION-code-mirror create mode 100644 app/assets/mode/commonlisp/commonlisp.js mode change 100755 => 100644 app/assets/mode/properties/properties.js create mode 100644 app/assets/mode/sieve/LICENSE create mode 100644 app/assets/mode/sieve/sieve.js delete mode 100644 app/assets/mode/xquery/test/testBase.js delete mode 100644 app/assets/mode/xquery/test/testEmptySequenceKeyword.js delete mode 100644 app/assets/mode/xquery/test/testMultiAttr.js delete mode 100644 app/assets/mode/xquery/test/testNamespaces.js delete mode 100644 app/assets/mode/xquery/test/testProcessingInstructions.js delete mode 100644 app/assets/mode/xquery/test/testQuotes.js diff --git a/app/assets/VERSION-code-mirror b/app/assets/VERSION-code-mirror new file mode 100644 index 000000000..3b2652486 --- /dev/null +++ b/app/assets/VERSION-code-mirror @@ -0,0 +1 @@ +2.3.5 \ No newline at end of file diff --git a/app/assets/lib/codemirror.css b/app/assets/lib/codemirror.css index fb5b6d544..41b8d09e1 100644 --- a/app/assets/lib/codemirror.css +++ b/app/assets/lib/codemirror.css @@ -9,8 +9,7 @@ } .CodeMirror-scroll { - overflow-x: auto; - overflow-y: hidden; + overflow: auto; height: 300px; /* This is needed to prevent an IE[67] bug where the scrolled content is visible outside of the scrolling box. */ @@ -20,13 +19,11 @@ /* Vertical scrollbar */ .CodeMirror-scrollbar { - float: right; + position: absolute; + right: 0; top: 0; overflow-x: hidden; overflow-y: scroll; - - /* This corrects for the 1px gap introduced to the left of the scrollbar - by the rule for .CodeMirror-scrollbar-inner. */ - margin-left: -1px; + z-index: 5; } .CodeMirror-scrollbar-inner { /* This needs to have a nonzero width in order for the scrollbar to appear @@ -69,10 +66,6 @@ white-space: pre; cursor: text; } -.CodeMirror-lines * { - /* Necessary for throw-scrolling to decelerate properly on Safari. */ - pointer-events: none; -} .CodeMirror pre { -moz-border-radius: 0; @@ -87,6 +80,7 @@ word-wrap: normal; line-height: inherit; color: inherit; + overflow: visible; } .CodeMirror-wrap pre { @@ -152,7 +146,7 @@ div.CodeMirror-selected { background: #d9d9d9; } .cm-s-default span.cm-error {color: #f00;} .cm-s-default span.cm-qualifier {color: #555;} .cm-s-default span.cm-builtin {color: #30a;} -.cm-s-default span.cm-bracket {color: #cc7;} +.cm-s-default span.cm-bracket {color: #997;} .cm-s-default span.cm-tag {color: #170;} .cm-s-default span.cm-attribute {color: #00c;} .cm-s-default span.cm-header {color: blue;} @@ -165,5 +159,16 @@ span.cm-em {font-style: italic;} span.cm-emstrong {font-style: italic; font-weight: bold;} span.cm-link {text-decoration: underline;} +span.cm-invalidchar {color: #f00;} + div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} + +@media print { + + /* Hide the cursor when printing */ + .CodeMirror pre.CodeMirror-cursor { + visibility: hidden; + } + +} diff --git a/app/assets/lib/codemirror.js b/app/assets/lib/codemirror.js index 532dd8974..e49481b58 100644 --- a/app/assets/lib/codemirror.js +++ b/app/assets/lib/codemirror.js @@ -1,11 +1,12 @@ -// CodeMirror version 2.32 +// CodeMirror version 2.35 // // All functions that need access to the editor's state live inside // the CodeMirror function. Below that, at the bottom of the file, // some utilities are defined. // CodeMirror is the only global var we claim -var CodeMirror = (function() { +window.CodeMirror = (function() { + "use strict"; // This is the function that produces an editor instance. Its // closure is used to store the editor state. function CodeMirror(place, givenOptions) { @@ -15,38 +16,33 @@ var CodeMirror = (function() { if (defaults.hasOwnProperty(opt)) options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt]; + var input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em"); + input.setAttribute("wrap", "off"); input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off"); + // Wraps and hides input textarea + var inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); + // The empty scrollbar content, used solely for managing the scrollbar thumb. + var scrollbarInner = elt("div", null, "CodeMirror-scrollbar-inner"); + // The vertical scrollbar. Horizontal scrolling is handled by the scroller itself. + var scrollbar = elt("div", [scrollbarInner], "CodeMirror-scrollbar"); + // DIVs containing the selection and the actual code + var lineDiv = elt("div"), selectionDiv = elt("div", null, null, "position: relative; z-index: -1"); + // Blinky cursor, and element used to ensure cursor fits at the end of a line + var cursor = elt("pre", "\u00a0", "CodeMirror-cursor"), widthForcer = elt("pre", "\u00a0", "CodeMirror-cursor", "visibility: hidden"); + // Used to measure text size + var measure = elt("div", null, null, "position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;"); + var lineSpace = elt("div", [measure, cursor, widthForcer, selectionDiv, lineDiv], null, "position: relative; z-index: 0"); + var gutterText = elt("div", null, "CodeMirror-gutter-text"), gutter = elt("div", [gutterText], "CodeMirror-gutter"); + // Moved around its parent to cover visible view + var mover = elt("div", [gutter, elt("div", [lineSpace], "CodeMirror-lines")], null, "position: relative"); + // Set to the height of the text, causes scrolling + var sizer = elt("div", [mover], null, "position: relative"); + // Provides scrolling + var scroller = elt("div", [sizer], "CodeMirror-scroll"); + scroller.setAttribute("tabIndex", "-1"); // The element in which the editor lives. - var wrapper = document.createElement("div"); - wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : ""); - // This mess creates the base DOM structure for the editor. - wrapper.innerHTML = - '
' + // Wraps and hides input textarea - '
' + - '
' + // The vertical scrollbar. Horizontal scrolling is handled by the scroller itself. - '
' + // The empty scrollbar content, used solely for managing the scrollbar thumb. - '
' + // This must be before the scroll area because it's float-right. - '
' + - '
' + // Set to the height of the text, causes scrolling - '
' + // Moved around its parent to cover visible view - '
' + - // Provides positioning relative to (visible) text origin - '
' + - // Used to measure text size - '
' + - '
 
' + // Absolutely positioned blinky cursor - '' + // Used to force a width - '
' + // DIVs containing the selection and the actual code - '
'; + var wrapper = elt("div", [inputDiv, scrollbar, scroller], "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : "")); if (place.appendChild) place.appendChild(wrapper); else place(wrapper); - // I've never seen more elegant code in my life. - var inputDiv = wrapper.firstChild, input = inputDiv.firstChild, - scroller = wrapper.lastChild, code = scroller.firstChild, - mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild, - lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild, - cursor = measure.nextSibling, widthForcer = cursor.nextSibling, - selectionDiv = widthForcer.nextSibling, lineDiv = selectionDiv.nextSibling, - scrollbar = inputDiv.nextSibling, scrollbarInner = scrollbar.firstChild; + themeChanged(); keyMapChanged(); // Needed to hide big blue blinking cursor on Mobile Safari if (ios) input.style.width = "0px"; @@ -58,33 +54,21 @@ var CodeMirror = (function() { // Needed to handle Tab key in KHTML if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute"; - // Check for OS X >= 10.7. If so, we need to force a width on the scrollbar, and - // make it overlap the content. (But we only do this if the scrollbar doesn't already - // have a natural width. If the mouse is plugged in or the user sets the system pref - // to always show scrollbars, the scrollbar shouldn't overlap.) - if (mac_geLion) { - scrollbar.className += (overlapScrollbars() ? " cm-sb-overlap" : " cm-sb-nonoverlap"); - } else if (ie_lt8) { - // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). - scrollbar.className += " cm-sb-ie7"; - } - - // Check for problem with IE innerHTML not working when we have a - // P (or similar) parent node. - try { stringWidth("x"); } - catch (e) { - if (e.message.match(/runtime/i)) - e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)"); - throw e; - } + // Check for OS X >= 10.7. This has transparent scrollbars, so the + // overlaying of one scrollbar with another won't work. This is a + // temporary hack to simply turn off the overlay scrollbar. See + // issue #727. + if (mac_geLion) { scrollbar.style.zIndex = -2; scrollbar.style.visibility = "hidden"; } + // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). + else if (ie_lt8) scrollbar.style.minWidth = "18px"; // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval. var poll = new Delayed(), highlight = new Delayed(), blinker; // mode holds a mode API object. doc is the tree of Line objects, - // work an array of lines that should be parsed, and history the - // undo history (instance of History constructor). - var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused; + // frontier is the point up to which the content has been parsed, + // and history the undo history (instance of History constructor). + var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), frontier = 0, focused; loadMode(); // The selection. These are always maintained to point at valid // positions. Inverted is used to remember that the user is @@ -92,11 +76,11 @@ var CodeMirror = (function() { var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false}; // Selection-related flags. shiftSelecting obviously tracks // whether the user is holding shift. - var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, lastScrollLeft = 0, draggingText, - overwrite = false, suppressEdits = false; + var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, draggingText, + overwrite = false, suppressEdits = false, pasteIncoming = false; // Variables used by startOperation/endOperation to track what // happened during the operation. - var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone, + var updateInput, userSelChange, changes, textChanged, selectionChanged, gutterDirty, callbacks; // Current visible range (may be bigger than the view window). var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0; @@ -105,8 +89,9 @@ var CodeMirror = (function() { var bracketHighlighted; // Tracks the maximum line length so that the horizontal scrollbar // can be kept static when scrolling. - var maxLine = "", updateMaxLine = false, maxLineChanged = true; - var tabCache = {}; + var maxLine = getLine(0), updateMaxLine = false, maxLineChanged = true; + var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll + var goalColumn = null; // Initialize the content. operation(function(){setValue(options.value || ""); updateInput = false;})(); @@ -120,12 +105,13 @@ var CodeMirror = (function() { // which point we can't mess with it anymore. Context menu is // handled in onMouseDown for Gecko. if (!gecko) connect(scroller, "contextmenu", onContextMenu); - connect(scroller, "scroll", onScroll); - connect(scrollbar, "scroll", onScroll); + connect(scroller, "scroll", onScrollMain); + connect(scrollbar, "scroll", onScrollBar); connect(scrollbar, "mousedown", function() {if (focused) setTimeout(focusInput, 0);}); - connect(scroller, "mousewheel", onMouseWheel); - connect(scroller, "DOMMouseScroll", onMouseWheel); - connect(window, "resize", function() {updateDisplay(true);}); + var resizeHandler = connect(window, "resize", function() { + if (wrapper.parentNode) updateDisplay(true); + else resizeHandler(); + }, true); connect(input, "keyup", operation(onKeyUp)); connect(input, "input", fastPoll); connect(input, "keydown", operation(onKeyDown)); @@ -133,24 +119,24 @@ var CodeMirror = (function() { connect(input, "focus", onFocus); connect(input, "blur", onBlur); + function drag_(e) { + if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return; + e_stop(e); + } if (options.dragDrop) { connect(scroller, "dragstart", onDragStart); - function drag_(e) { - if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return; - e_stop(e); - } connect(scroller, "dragenter", drag_); connect(scroller, "dragover", drag_); connect(scroller, "drop", operation(onDrop)); } connect(scroller, "paste", function(){focusInput(); fastPoll();}); - connect(input, "paste", fastPoll); + connect(input, "paste", function(){pasteIncoming = true; fastPoll();}); connect(input, "cut", operation(function(){ if (!options.readOnly) replaceSelection(""); })); // Needed to handle Tab key in KHTML - if (khtml) connect(code, "mouseup", function() { + if (khtml) connect(sizer, "mouseup", function() { if (document.activeElement == input) input.blur(); focusInput(); }); @@ -183,12 +169,15 @@ var CodeMirror = (function() { else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)(); else if (option == "tabSize") updateDisplay(true); else if (option == "keyMap") keyMapChanged(); - if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme") { + else if (option == "tabindex") input.tabIndex = value; + if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || + option == "theme" || option == "lineNumberFormatter") { gutterChanged(); updateDisplay(true); } }, getOption: function(option) {return options[option];}, + getMode: function() {return mode;}, undo: operation(undo), redo: operation(redo), indentLine: operation(function(n, dir) { @@ -207,13 +196,23 @@ var CodeMirror = (function() { history.undone = histData.undone; }, getHistory: function() { - history.time = 0; - return {done: history.done.concat([]), undone: history.undone.concat([])}; + function cp(arr) { + for (var i = 0, nw = [], nwelt; i < arr.length; ++i) { + nw.push(nwelt = []); + for (var j = 0, elt = arr[i]; j < elt.length; ++j) { + var old = [], cur = elt[j]; + nwelt.push({start: cur.start, added: cur.added, old: old}); + for (var k = 0; k < cur.old.length; ++k) old.push(hlText(cur.old[k])); + } + } + return nw; + } + return {done: cp(history.done), undone: cp(history.undone)}; }, matchBrackets: operation(function(){matchBrackets(true);}), getTokenAt: operation(function(pos) { pos = clipPos(pos); - return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch); + return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), options.tabSize, pos.ch); }), getStateAfter: function(line) { line = clipLine(line == null ? doc.size - 1: line); @@ -250,15 +249,16 @@ var CodeMirror = (function() { return line; }, lineInfo: lineInfo, + getViewport: function() { return {from: showingFrom, to: showingTo};}, addWidget: function(pos, node, scroll, vert, horiz) { pos = localCoords(clipPos(pos)); var top = pos.yBot, left = pos.x; node.style.position = "absolute"; - code.appendChild(node); + sizer.appendChild(node); if (vert == "over") top = pos.y; else if (vert == "near") { var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()), - hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft(); + hspace = Math.max(sizer.clientWidth, lineSpace.clientWidth) - paddingLeft(); if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight) top = pos.y - node.offsetHeight; if (left + node.offsetWidth > hspace) @@ -267,11 +267,11 @@ var CodeMirror = (function() { node.style.top = (top + paddingTop()) + "px"; node.style.left = node.style.right = ""; if (horiz == "right") { - left = code.clientWidth - node.offsetWidth; + left = sizer.clientWidth - node.offsetWidth; node.style.right = "0px"; } else { if (horiz == "left") left = 0; - else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2; + else if (horiz == "middle") left = (sizer.clientWidth - node.offsetWidth) / 2; node.style.left = (left + paddingLeft()) + "px"; } if (scroll) @@ -339,7 +339,7 @@ var CodeMirror = (function() { }, scrollTo: function(x, y) { if (x != null) scroller.scrollLeft = x; - if (y != null) scrollbar.scrollTop = y; + if (y != null) scrollbar.scrollTop = scroller.scrollTop = y; updateDisplay([]); }, getScrollInfo: function() { @@ -353,6 +353,7 @@ var CodeMirror = (function() { } if (width != null) wrapper.style.width = interpret(width); if (height != null) scroller.style.height = interpret(height); + instance.refresh(); }, operation: function(f){return operation(f)();}, @@ -375,6 +376,12 @@ var CodeMirror = (function() { for (var n = line; n; n = n.parent) n.height += diff; } + function lineContent(line, wrapAt) { + if (!line.styles) + line.highlight(mode, line.stateAfter = getStateBefore(lineNo(line)), options.tabSize); + return line.getContent(options.tabSize, wrapAt, options.lineWrapping); + } + function setValue(code) { var top = {line: 0, ch: 0}; updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length}, @@ -387,25 +394,30 @@ var CodeMirror = (function() { return text.join(lineSep || "\n"); } - function onScroll(e) { - if (scroller.scrollTop) { - scrollbar.scrollTop += scroller.scrollTop; - scroller.scrollTop = 0; + function onScrollBar(e) { + if (scrollbar.scrollTop != lastScrollTop) { + lastScrollTop = scroller.scrollTop = scrollbar.scrollTop; + updateDisplay([]); } - if (lastScrollTop != scrollbar.scrollTop || lastScrollLeft != scroller.scrollLeft) { - lastScrollTop = scrollbar.scrollTop; - lastScrollLeft = scroller.scrollLeft; + } + + function onScrollMain(e) { + if (options.fixedGutter && gutter.style.left != scroller.scrollLeft + "px") + gutter.style.left = scroller.scrollLeft + "px"; + if (scroller.scrollTop != lastScrollTop) { + lastScrollTop = scroller.scrollTop; + if (scrollbar.scrollTop != lastScrollTop) + scrollbar.scrollTop = lastScrollTop; updateDisplay([]); - if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px"; - if (options.onScroll) options.onScroll(instance); } + if (options.onScroll) options.onScroll(instance); } function onMouseDown(e) { setShift(e_prop(e, "shiftKey")); // Check whether this is a click in a widget for (var n = e_target(e); n != wrapper; n = n.parentNode) - if (n.parentNode == code && n != mover) return; + if (n.parentNode == sizer && n != mover) return; // See if this is a click in the gutter for (var n = e_target(e); n != wrapper; n = n.parentNode) @@ -448,21 +460,21 @@ var CodeMirror = (function() { setSelectionUser(word.from, word.to); } else { lastClick = {time: now, pos: start}; } + function dragEnd(e2) { + if (webkit) scroller.draggable = false; + draggingText = false; + up(); drop(); + if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { + e_preventDefault(e2); + setCursor(start.line, start.ch, true); + focusInput(); + } + } var last = start, going; if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) && !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") { // Let the drag handler handle this. if (webkit) scroller.draggable = true; - function dragEnd(e2) { - if (webkit) scroller.draggable = false; - draggingText = false; - up(); drop(); - if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { - e_preventDefault(e2); - setCursor(start.line, start.ch, true); - focusInput(); - } - } var up = connect(document, "mouseup", operation(dragEnd), true); var drop = connect(scroller, "drop", operation(dragEnd), true); draggingText = true; @@ -525,11 +537,12 @@ var CodeMirror = (function() { } function onDrop(e) { if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return; - e.preventDefault(); + e_preventDefault(e); var pos = posFromMouse(e, true), files = e.dataTransfer.files; if (!pos || options.readOnly) return; if (files && files.length && window.FileReader && window.File) { - function loadFile(file, i) { + var n = files.length, text = Array(n), read = 0; + var loadFile = function(file, i) { var reader = new FileReader; reader.onload = function() { text[i] = reader.result; @@ -542,8 +555,7 @@ var CodeMirror = (function() { } }; reader.readAsText(file); - } - var n = files.length, text = Array(n), read = 0; + }; for (var i = 0; i < n; ++i) loadFile(files[i], i); } else { // Don't do a replace if the drop happened inside of the selected text. @@ -566,13 +578,10 @@ var CodeMirror = (function() { function onDragStart(e) { var txt = getSelection(); e.dataTransfer.setData("Text", txt); - + // Use dummy image instead of default browsers image. - if (gecko || chrome || opera) { - var img = document.createElement('img'); - img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image - e.dataTransfer.setDragImage(img, 0, 0); - } + if (e.dataTransfer.setDragImage) + e.dataTransfer.setDragImage(elt('img'), 0, 0); } function doHandleBinding(bound, dropShift) { @@ -594,6 +603,7 @@ var CodeMirror = (function() { } return true; } + var maybeTransition; function handleKeyBinding(e) { // Handle auto keymap transitions var startMap = getKeyMap(options.keyMap), next = startMap.auto; @@ -605,10 +615,11 @@ var CodeMirror = (function() { }, 50); var name = keyNames[e_prop(e, "keyCode")], handled = false; + var flipCtrlCmd = opera && mac; if (name == null || e.altGraphKey) return false; if (e_prop(e, "altKey")) name = "Alt-" + name; - if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name; - if (e_prop(e, "metaKey")) name = "Cmd-" + name; + if (e_prop(e, flipCtrlCmd ? "metaKey" : "ctrlKey")) name = "Ctrl-" + name; + if (e_prop(e, flipCtrlCmd ? "ctrlKey" : "metaKey")) name = "Cmd-" + name; var stopped = false; function stop() { stopped = true; } @@ -640,7 +651,7 @@ var CodeMirror = (function() { return handled; } - var lastStoppedKey = null, maybeTransition; + var lastStoppedKey = null; function onKeyDown(e) { if (!focused) onFocus(); if (ie && e.keyCode == 27) { e.returnValue = false; } @@ -684,7 +695,6 @@ var CodeMirror = (function() { focused = true; if (scroller.className.search(/\bCodeMirror-focused\b/) == -1) scroller.className += " CodeMirror-focused"; - if (!leaveInputAlone) resetInput(true); } slowPoll(); restartBlink(); @@ -703,53 +713,20 @@ var CodeMirror = (function() { setTimeout(function() {if (!focused) shiftSelecting = null;}, 150); } - function chopDelta(delta) { - // Make sure we always scroll a little bit for any nonzero delta. - if (delta > 0.0 && delta < 1.0) return 1; - else if (delta > -1.0 && delta < 0.0) return -1; - else return Math.round(delta); - } - - function onMouseWheel(e) { - var deltaX = 0, deltaY = 0; - if (e.type == "DOMMouseScroll") { // Firefox - var delta = -e.detail * 8.0; - if (e.axis == e.HORIZONTAL_AXIS) deltaX = delta; - else if (e.axis == e.VERTICAL_AXIS) deltaY = delta; - } else if (e.wheelDeltaX !== undefined && e.wheelDeltaY !== undefined) { // WebKit - deltaX = e.wheelDeltaX / 3.0; - deltaY = e.wheelDeltaY / 3.0; - } else if (e.wheelDelta !== undefined) { // IE or Opera - deltaY = e.wheelDelta / 3.0; - } - - var scrolled = false; - deltaX = chopDelta(deltaX); - deltaY = chopDelta(deltaY); - if ((deltaX > 0 && scroller.scrollLeft > 0) || - (deltaX < 0 && scroller.scrollLeft + scroller.clientWidth < scroller.scrollWidth)) { - scroller.scrollLeft -= deltaX; - scrolled = true; - } - if ((deltaY > 0 && scrollbar.scrollTop > 0) || - (deltaY < 0 && scrollbar.scrollTop + scrollbar.clientHeight < scrollbar.scrollHeight)) { - scrollbar.scrollTop -= deltaY; - scrolled = true; - } - if (scrolled) e_stop(e); - } - // Replace the range from from to to by the strings in newText. // Afterwards, set the selection to selFrom, selTo. function updateLines(from, to, newText, selFrom, selTo) { if (suppressEdits) return; + var old = []; + doc.iter(from.line, to.line + 1, function(line) { + old.push(newHL(line.text, line.markedSpans)); + }); if (history) { - var old = []; - doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); }); history.addChange(from.line, newText.length, old); while (history.done.length > options.undoDepth) history.done.shift(); } - updateLinesNoUndo(from, to, newText, selFrom, selTo); + var lines = updateMarkedSpans(hlSpans(old[0]), hlSpans(lst(old)), from.ch, to.ch, newText); + updateLinesNoUndo(from, to, lines, selFrom, selTo); } function unredoHelper(from, to) { if (!from.length) return; @@ -757,11 +734,12 @@ var CodeMirror = (function() { for (var i = set.length - 1; i >= 0; i -= 1) { var change = set[i]; var replaced = [], end = change.start + change.added; - doc.iter(change.start, end, function(line) { replaced.push(line.text); }); + doc.iter(change.start, end, function(line) { replaced.push(newHL(line.text, line.markedSpans)); }); out.push({start: change.start, added: change.old.length, old: replaced}); var pos = {line: change.start + change.old.length - 1, - ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])}; - updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos); + ch: editEnd(hlText(lst(replaced)), hlText(lst(change.old)))}; + updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, + change.old, pos, pos); } updateInput = true; to.push(out); @@ -769,95 +747,86 @@ var CodeMirror = (function() { function undo() {unredoHelper(history.done, history.undone);} function redo() {unredoHelper(history.undone, history.done);} - function updateLinesNoUndo(from, to, newText, selFrom, selTo) { + function updateLinesNoUndo(from, to, lines, selFrom, selTo) { if (suppressEdits) return; - var recomputeMaxLength = false, maxLineLength = maxLine.length; + var recomputeMaxLength = false, maxLineLength = maxLine.text.length; if (!options.lineWrapping) doc.iter(from.line, to.line + 1, function(line) { if (!line.hidden && line.text.length == maxLineLength) {recomputeMaxLength = true; return true;} }); - if (from.line != to.line || newText.length > 1) gutterDirty = true; + if (from.line != to.line || lines.length > 1) gutterDirty = true; var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line); - // First adjust the line structure, taking some care to leave highlighting intact. - if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") { + var lastHL = lst(lines); + + // First adjust the line structure + if (from.ch == 0 && to.ch == 0 && hlText(lastHL) == "") { // This is a whole-line replace. Treated specially to make // sure line objects move the way they are supposed to. var added = [], prevLine = null; - if (from.line) { - prevLine = getLine(from.line - 1); - prevLine.fixMarkEnds(lastLine); - } else lastLine.fixMarkStarts(); - for (var i = 0, e = newText.length - 1; i < e; ++i) - added.push(Line.inheritMarks(newText[i], prevLine)); + for (var i = 0, e = lines.length - 1; i < e; ++i) + added.push(new Line(hlText(lines[i]), hlSpans(lines[i]))); + lastLine.update(lastLine.text, hlSpans(lastHL)); if (nlines) doc.remove(from.line, nlines, callbacks); if (added.length) doc.insert(from.line, added); } else if (firstLine == lastLine) { - if (newText.length == 1) - firstLine.replace(from.ch, to.ch, newText[0]); - else { - lastLine = firstLine.split(to.ch, newText[newText.length-1]); - firstLine.replace(from.ch, null, newText[0]); - firstLine.fixMarkEnds(lastLine); - var added = []; - for (var i = 1, e = newText.length - 1; i < e; ++i) - added.push(Line.inheritMarks(newText[i], firstLine)); - added.push(lastLine); + if (lines.length == 1) { + firstLine.update(firstLine.text.slice(0, from.ch) + hlText(lines[0]) + firstLine.text.slice(to.ch), hlSpans(lines[0])); + } else { + for (var added = [], i = 1, e = lines.length - 1; i < e; ++i) + added.push(new Line(hlText(lines[i]), hlSpans(lines[i]))); + added.push(new Line(hlText(lastHL) + firstLine.text.slice(to.ch), hlSpans(lastHL))); + firstLine.update(firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0])); doc.insert(from.line + 1, added); } - } else if (newText.length == 1) { - firstLine.replace(from.ch, null, newText[0]); - lastLine.replace(null, to.ch, ""); - firstLine.append(lastLine); + } else if (lines.length == 1) { + firstLine.update(firstLine.text.slice(0, from.ch) + hlText(lines[0]) + lastLine.text.slice(to.ch), hlSpans(lines[0])); doc.remove(from.line + 1, nlines, callbacks); } else { var added = []; - firstLine.replace(from.ch, null, newText[0]); - lastLine.replace(null, to.ch, newText[newText.length-1]); - firstLine.fixMarkEnds(lastLine); - for (var i = 1, e = newText.length - 1; i < e; ++i) - added.push(Line.inheritMarks(newText[i], firstLine)); + firstLine.update(firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0])); + lastLine.update(hlText(lastHL) + lastLine.text.slice(to.ch), hlSpans(lastHL)); + for (var i = 1, e = lines.length - 1; i < e; ++i) + added.push(new Line(hlText(lines[i]), hlSpans(lines[i]))); if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks); doc.insert(from.line + 1, added); } if (options.lineWrapping) { var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3); - doc.iter(from.line, from.line + newText.length, function(line) { + doc.iter(from.line, from.line + lines.length, function(line) { if (line.hidden) return; var guess = Math.ceil(line.text.length / perLine) || 1; if (guess != line.height) updateLineHeight(line, guess); }); } else { - doc.iter(from.line, from.line + newText.length, function(line) { + doc.iter(from.line, from.line + lines.length, function(line) { var l = line.text; if (!line.hidden && l.length > maxLineLength) { - maxLine = l; maxLineLength = l.length; maxLineChanged = true; + maxLine = line; maxLineLength = l.length; maxLineChanged = true; recomputeMaxLength = false; } }); if (recomputeMaxLength) updateMaxLine = true; } - // Add these lines to the work array, so that they will be - // highlighted. Adjust work lines if lines were added/removed. - var newWork = [], lendiff = newText.length - nlines - 1; - for (var i = 0, l = work.length; i < l; ++i) { - var task = work[i]; - if (task < from.line) newWork.push(task); - else if (task > to.line) newWork.push(task + lendiff); - } - var hlEnd = from.line + Math.min(newText.length, 500); - highlightLines(from.line, hlEnd); - newWork.push(hlEnd); - work = newWork; - startWorker(100); + // Adjust frontier, schedule worker + frontier = Math.min(frontier, from.line); + startWorker(400); + + var lendiff = lines.length - nlines - 1; // Remember that these lines changed, for updating the display changes.push({from: from.line, to: to.line + 1, diff: lendiff}); - var changeObj = {from: from, to: to, text: newText}; - if (textChanged) { - for (var cur = textChanged; cur.next; cur = cur.next) {} - cur.next = changeObj; - } else textChanged = changeObj; + if (options.onChange) { + // Normalize lines to contain only strings, since that's what + // the change event handler expects + for (var i = 0; i < lines.length; ++i) + if (typeof lines[i] != "string") lines[i] = lines[i].text; + var changeObj = {from: from, to: to, text: lines}; + if (textChanged) { + for (var cur = textChanged; cur.next; cur = cur.next) {} + cur.next = changeObj; + } else textChanged = changeObj; + } // Update the selection function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;} @@ -867,46 +836,43 @@ var CodeMirror = (function() { function needsScrollbar() { var realHeight = doc.height * textHeight() + 2 * paddingTop(); - return realHeight - 1 > scroller.offsetHeight ? realHeight : false; + return realHeight * .99 > scroller.offsetHeight ? realHeight : false; } function updateVerticalScroll(scrollTop) { var scrollHeight = needsScrollbar(); scrollbar.style.display = scrollHeight ? "block" : "none"; if (scrollHeight) { - scrollbarInner.style.height = scrollHeight + "px"; - scrollbar.style.height = scroller.offsetHeight + "px"; - if (scrollTop != null) scrollbar.scrollTop = scrollTop; + scrollbarInner.style.height = sizer.style.minHeight = scrollHeight + "px"; + scrollbar.style.height = scroller.clientHeight + "px"; + if (scrollTop != null) { + scrollbar.scrollTop = scroller.scrollTop = scrollTop; + // 'Nudge' the scrollbar to work around a Webkit bug where, + // in some situations, we'd end up with a scrollbar that + // reported its scrollTop (and looked) as expected, but + // *behaved* as if it was still in a previous state (i.e. + // couldn't scroll up, even though it appeared to be at the + // bottom). + if (webkit) setTimeout(function() { + if (scrollbar.scrollTop != scrollTop) return; + scrollbar.scrollTop = scrollTop + (scrollTop ? -1 : 1); + scrollbar.scrollTop = scrollTop; + }, 0); + } + } else { + sizer.style.minHeight = ""; } // Position the mover div to align with the current virtual scroll position - mover.style.top = (displayOffset * textHeight() - scrollbar.scrollTop) + "px"; - } - - // On Mac OS X Lion and up, detect whether the mouse is plugged in by measuring - // the width of a div with a scrollbar in it. If the width is <= 1, then - // the mouse isn't plugged in and scrollbars should overlap the content. - function overlapScrollbars() { - var tmpSb = document.createElement('div'), - tmpSbInner = document.createElement('div'); - tmpSb.className = "CodeMirror-scrollbar"; - tmpSb.style.cssText = "position: absolute; left: -9999px; height: 100px;"; - tmpSbInner.className = "CodeMirror-scrollbar-inner"; - tmpSbInner.style.height = "200px"; - tmpSb.appendChild(tmpSbInner); - - document.body.appendChild(tmpSb); - var result = (tmpSb.offsetWidth <= 1); - document.body.removeChild(tmpSb); - return result; + mover.style.top = displayOffset * textHeight() + "px"; } function computeMaxLength() { - var maxLineLength = 0; - maxLine = ""; maxLineChanged = true; - doc.iter(0, doc.size, function(line) { + maxLine = getLine(0); maxLineChanged = true; + var maxLineLength = maxLine.text.length; + doc.iter(1, doc.size, function(line) { var l = line.text; if (!line.hidden && l.length > maxLineLength) { - maxLineLength = l.length; maxLine = l; + maxLineLength = l.length; maxLine = line; } }); updateMaxLine = false; @@ -922,7 +888,7 @@ var CodeMirror = (function() { var line = pos.line + code.length - (to.line - from.line) - 1; var ch = pos.ch; if (pos.line == to.line) - ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0)); + ch += lst(code).length - (to.ch - (to.line == from.line ? from.ch : 0)); return {line: line, ch: ch}; } var end; @@ -940,7 +906,7 @@ var CodeMirror = (function() { }); } function replaceRange1(code, from, to, computeSel) { - var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length; + var endch = code.length == 1 ? code[0].length + from.ch : lst(code).length; var newSel = computeSel({line: from.line + code.length - 1, ch: endch}); updateLines(from, to, code, newSel.from, newSel.to); } @@ -957,25 +923,20 @@ var CodeMirror = (function() { return getRange(sel.from, sel.to, lineSep); } - var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll function slowPoll() { if (pollingFast) return; poll.set(options.pollInterval, function() { - startOperation(); readInput(); if (focused) slowPoll(); - endOperation(); }); } function fastPoll() { var missed = false; pollingFast = true; function p() { - startOperation(); var changed = readInput(); if (!changed && !missed) {missed = true; poll.set(60, p);} else {pollingFast = false; slowPoll();} - endOperation(); } poll.set(20, p); } @@ -987,26 +948,29 @@ var CodeMirror = (function() { // supported or compatible enough yet to rely on.) var prevInput = ""; function readInput() { - if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false; + if (!focused || hasSelection(input) || options.readOnly) return false; var text = input.value; if (text == prevInput) return false; + if (!nestedOperation) startOperation(); shiftSelecting = null; var same = 0, l = Math.min(prevInput.length, text.length); while (same < l && prevInput[same] == text[same]) ++same; if (same < prevInput.length) sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)}; - else if (overwrite && posEq(sel.from, sel.to)) + else if (overwrite && posEq(sel.from, sel.to) && !pasteIncoming) sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))}; replaceSelection(text.slice(same), "end"); if (text.length > 1000) { input.value = prevInput = ""; } else prevInput = text; + if (!nestedOperation) endOperation(); + pasteIncoming = false; return true; } function resetInput(user) { if (!posEq(sel.from, sel.to)) { prevInput = ""; input.value = getSelection(); - selectInput(input); + if (focused) selectInput(input); } else if (user) prevInput = input.value = ""; } @@ -1014,16 +978,23 @@ var CodeMirror = (function() { if (options.readOnly != "nocursor") input.focus(); } - function scrollEditorIntoView() { - var rect = cursor.getBoundingClientRect(); - // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden - if (ie && rect.top == rect.bottom) return; - var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight); - if (rect.top < 0 || rect.bottom > winH) scrollCursorIntoView(); - } function scrollCursorIntoView() { var coords = calculateCursorCoords(); - return scrollIntoView(coords.x, coords.y, coords.x, coords.yBot); + scrollIntoView(coords.x, coords.y, coords.x, coords.yBot); + if (!focused) return; + var box = sizer.getBoundingClientRect(), doScroll = null; + if (coords.y + box.top < 0) doScroll = true; + else if (coords.y + box.top + textHeight() > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false; + if (doScroll != null) { + var hidden = cursor.style.display == "none"; + if (hidden) { + cursor.style.display = ""; + cursor.style.left = coords.x + "px"; + cursor.style.top = (coords.y - displayOffset) + "px"; + } + cursor.scrollIntoView(doScroll); + if (hidden) cursor.style.display = "none"; + } } function calculateCursorCoords() { var cursor = localCoords(sel.inverted ? sel.from : sel.to); @@ -1031,17 +1002,16 @@ var CodeMirror = (function() { return {x: x, y: cursor.y, yBot: cursor.yBot}; } function scrollIntoView(x1, y1, x2, y2) { - var scrollPos = calculateScrollPos(x1, y1, x2, y2), scrolled = false; - if (scrollPos.scrollLeft != null) {scroller.scrollLeft = scrollPos.scrollLeft; scrolled = true;} - if (scrollPos.scrollTop != null) {scrollbar.scrollTop = scrollPos.scrollTop; scrolled = true;} - if (scrolled && options.onScroll) options.onScroll(instance); + var scrollPos = calculateScrollPos(x1, y1, x2, y2); + if (scrollPos.scrollLeft != null) {scroller.scrollLeft = scrollPos.scrollLeft;} + if (scrollPos.scrollTop != null) {scrollbar.scrollTop = scroller.scrollTop = scrollPos.scrollTop;} } function calculateScrollPos(x1, y1, x2, y2) { var pl = paddingLeft(), pt = paddingTop(); y1 += pt; y2 += pt; x1 += pl; x2 += pl; var screen = scroller.clientHeight, screentop = scrollbar.scrollTop, result = {}; - var docBottom = scroller.scrollHeight; - var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10;; + var docBottom = needsScrollbar() || Infinity; + var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10; if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1); else if (y2 > screentop + screen) result.scrollTop = (atBottom ? docBottom : y2) - screen; @@ -1113,8 +1083,13 @@ var CodeMirror = (function() { // This is just a bogus formula that detects when the editor is // resized or the font size changes. if (different) lastSizeC = scroller.clientHeight + th; + if (from != showingFrom || to != showingTo && options.onViewportChange) + setTimeout(function(){ + if (options.onViewportChange) options.onViewportChange(instance, from, to); + }); showingFrom = from; showingTo = to; displayOffset = heightAtLine(doc, from); + startWorker(100); // Since this is all rather error prone, it is honoured with the // only assertion in the whole file. @@ -1125,6 +1100,10 @@ var CodeMirror = (function() { function checkHeights() { var curNode = lineDiv.firstChild, heightChanged = false; doc.iter(showingFrom, showingTo, function(line) { + // Work around bizarro IE7 bug where, sometimes, our curNode + // is magically replaced with a new node in the DOM, leaving + // us with a reference to an orphan (nextSibling-less) node. + if (!curNode) return; if (!line.hidden) { var height = Math.round(curNode.offsetHeight / th) || 1; if (line.height != height) { @@ -1137,16 +1116,7 @@ var CodeMirror = (function() { return heightChanged; } - if (options.lineWrapping) { - checkHeights(); - var scrollHeight = needsScrollbar(); - var shouldHaveScrollbar = scrollHeight ? "block" : "none"; - if (scrollbar.style.display != shouldHaveScrollbar) { - scrollbar.style.display = shouldHaveScrollbar; - if (scrollHeight) scrollbarInner.style.height = scrollHeight + "px"; - checkHeights(); - } - } + if (options.lineWrapping) checkHeights(); gutter.style.display = gutterDisplay; if (different || gutterDirty) { @@ -1183,14 +1153,14 @@ var CodeMirror = (function() { } function patchDisplay(from, to, intact) { + function killNode(node) { + var tmp = node.nextSibling; + node.parentNode.removeChild(node); + return tmp; + } // The first pass removes the DOM nodes that aren't intact. - if (!intact.length) lineDiv.innerHTML = ""; + if (!intact.length) removeChildren(lineDiv); else { - function killNode(node) { - var tmp = node.nextSibling; - node.parentNode.removeChild(node); - return tmp; - } var domPos = 0, curNode = lineDiv.firstChild, n; for (var i = 0; i < intact.length; ++i) { var cur = intact[i]; @@ -1201,21 +1171,20 @@ var CodeMirror = (function() { } // This pass fills in the lines that actually changed. var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from; - var scratch = document.createElement("div"); doc.iter(from, to, function(line) { if (nextIntact && nextIntact.to == j) nextIntact = intact.shift(); if (!nextIntact || nextIntact.from > j) { - if (line.hidden) var html = scratch.innerHTML = "
";
+          if (line.hidden) var lineElement = elt("pre");
           else {
-            var html = ''
-              + line.getHTML(makeTab) + '';
+            var lineElement = lineContent(line);
+            if (line.className) lineElement.className = line.className;
             // Kludge to make sure the styled element lies behind the selection (by z-index)
-            if (line.bgClassName)
-              html = '
 
' + html + "
"; + if (line.bgClassName) { + var pre = elt("pre", "\u00a0", line.bgClassName, "position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"); + lineElement = elt("div", [pre, lineElement], null, "position: relative"); + } } - scratch.innerHTML = html; - lineDiv.insertBefore(scratch.firstChild, curNode); + lineDiv.insertBefore(lineElement, curNode); } else { curNode = curNode.nextSibling; } @@ -1227,10 +1196,10 @@ var CodeMirror = (function() { if (!options.gutter && !options.lineNumbers) return; var hText = mover.offsetHeight, hEditor = scroller.clientHeight; gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px"; - var html = [], i = showingFrom, normalNode; + var fragment = document.createDocumentFragment(), i = showingFrom, normalNode; doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) { if (line.hidden) { - html.push("
");
+          fragment.appendChild(elt("pre"));
         } else {
           var marker = line.gutterMarker;
           var text = options.lineNumbers ? options.lineNumberFormatter(i + options.firstLineNumber) : null;
@@ -1238,15 +1207,18 @@ var CodeMirror = (function() {
             text = marker.text.replace("%N%", text != null ? text : "");
           else if (text == null)
             text = "\u00a0";
-          html.push((marker && marker.style ? '
' : "
"), text);
-          for (var j = 1; j < line.height; ++j) html.push("
 "); - html.push("
"); + var markerElement = fragment.appendChild(elt("pre", null, marker && marker.style)); + markerElement.innerHTML = text; + for (var j = 1; j < line.height; ++j) { + markerElement.appendChild(elt("br")); + markerElement.appendChild(document.createTextNode("\u00a0")); + } if (!marker) normalNode = i; } ++i; }); gutter.style.display = "none"; - gutterText.innerHTML = html.join(""); + removeChildrenAndAdd(gutterText, fragment); // Make sure scrolling doesn't cause number gutter size to pop if (normalNode != null && options.lineNumbers) { var node = gutterText.childNodes[normalNode - showingFrom]; @@ -1274,15 +1246,15 @@ var CodeMirror = (function() { cursor.style.display = ""; selectionDiv.style.display = "none"; } else { - var sameLine = fromPos.y == toPos.y, html = ""; + var sameLine = fromPos.y == toPos.y, fragment = document.createDocumentFragment(); var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth; var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight; - function add(left, top, right, height) { + var add = function(left, top, right, height) { var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px" : "right: " + right + "px"; - html += '
'; - } + fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left + + "px; top: " + top + "px; " + rstyle + "; height: " + height + "px")); + }; if (sel.from.ch && fromPos.y >= 0) { var right = sameLine ? clientWidth - toPos.x : 0; add(fromPos.x, fromPos.y, right, th); @@ -1293,7 +1265,7 @@ var CodeMirror = (function() { add(0, middleStart, 0, middleHeight); if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th) add(0, toPos.y, clientWidth - toPos.x, th); - selectionDiv.innerHTML = html; + removeChildrenAndAdd(selectionDiv, fragment); cursor.style.display = "none"; selectionDiv.style.display = ""; } @@ -1425,13 +1397,16 @@ var CodeMirror = (function() { else replaceRange("", sel.from, findPosH(dir, unit)); userSelChange = true; } - var goalColumn = null; function moveV(dir, unit) { var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true); if (goalColumn != null) pos.x = goalColumn; - if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight); - else if (unit == "line") dist = textHeight(); - var target = coordsChar(pos.x, pos.y + dist * dir + 2); + if (unit == "page") { + var screen = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight); + var target = coordsChar(pos.x, pos.y + screen * dir); + } else if (unit == "line") { + var th = textHeight(); + var target = coordsChar(pos.x, pos.y + .5 * th + dir * th); + } if (unit == "page") scrollbar.scrollTop += localCoords(target, true).y - pos.y; setCursor(target.line, target.ch, true); goalColumn = pos.x; @@ -1440,10 +1415,15 @@ var CodeMirror = (function() { function findWordAt(pos) { var line = getLine(pos.line).text; var start = pos.ch, end = pos.ch; - var check = isWordChar(line.charAt(start < line.length ? start : start - 1)) ? - isWordChar : function(ch) {return !isWordChar(ch);}; - while (start > 0 && check(line.charAt(start - 1))) --start; - while (end < line.length && check(line.charAt(end))) ++end; + if (line) { + if (pos.after === false || end == line.length) --start; else ++end; + var startChar = line.charAt(start); + var check = isWordChar(startChar) ? isWordChar : + /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} : + function(ch) {return !/\s/.test(ch) && isWordChar(ch);}; + while (start > 0 && check(line.charAt(start - 1))) --start; + while (end < line.length && check(line.charAt(end))) ++end; + } return {from: {line: pos.line, ch: start}, to: {line: pos.line, ch: end}}; } function selectLine(line) { @@ -1480,16 +1460,18 @@ var CodeMirror = (function() { var indentString = "", pos = 0; if (options.indentWithTabs) for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += "\t";} - while (pos < indentation) {++pos; indentString += " ";} + if (pos < indentation) indentString += spaceStr(indentation - pos); - replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length}); + if (indentString != curSpaceString) + replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length}); + line.stateAfter = null; } function loadMode() { mode = CodeMirror.getMode(options, options.mode); doc.iter(0, doc.size, function(line) { line.stateAfter = null; }); - work = [0]; - startWorker(); + frontier = 0; + startWorker(100); } function gutterChanged() { var visible = options.gutter || options.lineNumbers; @@ -1506,24 +1488,16 @@ var CodeMirror = (function() { var guess = Math.ceil(line.text.length / perLine) || 1; if (guess != 1) updateLineHeight(line, guess); }); - lineSpace.style.width = code.style.width = ""; - widthForcer.style.left = ""; + lineSpace.style.minWidth = widthForcer.style.left = ""; } else { wrapper.className = wrapper.className.replace(" CodeMirror-wrap", ""); - maxLine = ""; maxLineChanged = true; + computeMaxLength(); doc.iter(0, doc.size, function(line) { if (line.height != 1 && !line.hidden) updateLineHeight(line, 1); - if (line.text.length > maxLine.length) maxLine = line.text; }); } changes.push({from: 0, to: doc.size}); } - function makeTab(col) { - var w = options.tabSize - col % options.tabSize, cached = tabCache[w]; - if (cached) return cached; - for (var str = '', i = 0; i < w; ++i) str += " "; - return (tabCache[w] = {html: str + "", width: w}); - } function themeChanged() { scroller.className = scroller.className.replace(/\s*cm-s-\S+/g, "") + options.theme.replace(/(^|\s)\s*/g, " cm-s-"); @@ -1534,74 +1508,71 @@ var CodeMirror = (function() { (style ? " cm-keymap-" + style : ""); } - function TextMarker() { this.set = []; } + function TextMarker(type, style) { this.lines = []; this.type = type; if (style) this.style = style; } TextMarker.prototype.clear = operation(function() { - var min = Infinity, max = -Infinity; - for (var i = 0, e = this.set.length; i < e; ++i) { - var line = this.set[i], mk = line.marked; - if (!mk || !line.parent) continue; - var lineN = lineNo(line); - min = Math.min(min, lineN); max = Math.max(max, lineN); - for (var j = 0; j < mk.length; ++j) - if (mk[j].marker == this) mk.splice(j--, 1); - } - if (min != Infinity) - changes.push({from: min, to: max + 1}); + var min, max; + for (var i = 0; i < this.lines.length; ++i) { + var line = this.lines[i]; + var span = getMarkedSpanFor(line.markedSpans, this); + if (span.from != null) min = lineNo(line); + if (span.to != null) max = lineNo(line); + line.markedSpans = removeMarkedSpan(line.markedSpans, span); + } + if (min != null) changes.push({from: min, to: max + 1}); + this.lines.length = 0; + this.explicitlyCleared = true; }); TextMarker.prototype.find = function() { var from, to; - for (var i = 0, e = this.set.length; i < e; ++i) { - var line = this.set[i], mk = line.marked; - for (var j = 0; j < mk.length; ++j) { - var mark = mk[j]; - if (mark.marker == this) { - if (mark.from != null || mark.to != null) { - var found = lineNo(line); - if (found != null) { - if (mark.from != null) from = {line: found, ch: mark.from}; - if (mark.to != null) to = {line: found, ch: mark.to}; - } - } - } + for (var i = 0; i < this.lines.length; ++i) { + var line = this.lines[i]; + var span = getMarkedSpanFor(line.markedSpans, this); + if (span.from != null || span.to != null) { + var found = lineNo(line); + if (span.from != null) from = {line: found, ch: span.from}; + if (span.to != null) to = {line: found, ch: span.to}; } } - return {from: from, to: to}; + if (this.type == "bookmark") return from; + return from && {from: from, to: to}; }; - function markText(from, to, className) { + function markText(from, to, className, options) { from = clipPos(from); to = clipPos(to); - var tm = new TextMarker(); - if (!posLess(from, to)) return tm; - function add(line, from, to, className) { - getLine(line).addMark(new MarkedText(from, to, className, tm)); - } - if (from.line == to.line) add(from.line, from.ch, to.ch, className); - else { - add(from.line, from.ch, null, className); - for (var i = from.line + 1, e = to.line; i < e; ++i) - add(i, null, null, className); - add(to.line, null, to.ch, className); - } + var marker = new TextMarker("range", className); + if (options) for (var opt in options) if (options.hasOwnProperty(opt)) + marker[opt] = options[opt]; + var curLine = from.line; + doc.iter(curLine, to.line + 1, function(line) { + var span = {from: curLine == from.line ? from.ch : null, + to: curLine == to.line ? to.ch : null, + marker: marker}; + line.markedSpans = (line.markedSpans || []).concat([span]); + marker.lines.push(line); + ++curLine; + }); changes.push({from: from.line, to: to.line + 1}); - return tm; + return marker; } function setBookmark(pos) { pos = clipPos(pos); - var bm = new Bookmark(pos.ch); - getLine(pos.line).addMark(bm); - return bm; + var marker = new TextMarker("bookmark"), line = getLine(pos.line); + history.addChange(pos.line, 1, [newHL(line.text, line.markedSpans)], true); + var span = {from: pos.ch, to: pos.ch, marker: marker}; + line.markedSpans = (line.markedSpans || []).concat([span]); + marker.lines.push(line); + return marker; } function findMarksAt(pos) { pos = clipPos(pos); - var markers = [], marked = getLine(pos.line).marked; - if (!marked) return markers; - for (var i = 0, e = marked.length; i < e; ++i) { - var m = marked[i]; - if ((m.from == null || m.from <= pos.ch) && - (m.to == null || m.to >= pos.ch)) - markers.push(m.marker || m); + var markers = [], spans = getLine(pos.line).markedSpans; + if (spans) for (var i = 0; i < spans.length; ++i) { + var span = spans[i]; + if ((span.from == null || span.from <= pos.ch) && + (span.to == null || span.to >= pos.ch)) + markers.push(span.marker); } return markers; } @@ -1641,11 +1612,10 @@ var CodeMirror = (function() { if (line.hidden != hidden) { line.hidden = hidden; if (!options.lineWrapping) { - var l = line.text; - if (hidden && l.length == maxLine.length) { + if (hidden && line.text.length == maxLine.text.length) { updateMaxLine = true; - } else if (!hidden && l.length > maxLine.length) { - maxLine = l; updateMaxLine = false; + } else if (!hidden && line.text.length > maxLine.text.length) { + maxLine = line; updateMaxLine = false; } } updateLineHeight(line, hidden ? 0 : 1); @@ -1677,53 +1647,16 @@ var CodeMirror = (function() { markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName}; } - function stringWidth(str) { - measure.innerHTML = "
x
"; - measure.firstChild.firstChild.firstChild.nodeValue = str; - return measure.firstChild.firstChild.offsetWidth || 10; - } - // These are used to go from pixel positions to character - // positions, taking varying character widths into account. - function charFromX(line, x) { - if (x <= 0) return 0; - var lineObj = getLine(line), text = lineObj.text; - function getX(len) { - return measureLine(lineObj, len).left; - } - var from = 0, fromX = 0, to = text.length, toX; - // Guess a suitable upper bound for our search. - var estimated = Math.min(to, Math.ceil(x / charWidth())); - for (;;) { - var estX = getX(estimated); - if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2)); - else {toX = estX; to = estimated; break;} - } - if (x > toX) return to; - // Try to guess a suitable lower bound as well. - estimated = Math.floor(to * 0.8); estX = getX(estimated); - if (estX < x) {from = estimated; fromX = estX;} - // Do a binary search between these bounds. - for (;;) { - if (to - from <= 1) return (toX - x > x - fromX) ? from : to; - var middle = Math.ceil((from + to) / 2), middleX = getX(middle); - if (middleX > x) {to = middle; toX = middleX;} - else {from = middle; fromX = middleX;} - } - } - - var tempId = "CodeMirror-temp-" + Math.floor(Math.random() * 0xffffff).toString(16); function measureLine(line, ch) { if (ch == 0) return {top: 0, left: 0}; - var wbr = options.lineWrapping && ch < line.text.length && - spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1)); - measure.innerHTML = "
" + line.getHTML(makeTab, ch, tempId, wbr) + "
"; - var elt = document.getElementById(tempId); - var top = elt.offsetTop, left = elt.offsetLeft; + var pre = lineContent(line, ch); + removeChildrenAndAdd(measure, pre); + var anchor = pre.anchor; + var top = anchor.offsetTop, left = anchor.offsetLeft; // Older IEs report zero offsets for spans directly after a wrap if (ie && top == 0 && left == 0) { - var backup = document.createElement("span"); - backup.innerHTML = "x"; - elt.parentNode.insertBefore(backup, elt.nextSibling); + var backup = elt("span", "x"); + anchor.parentNode.insertBefore(backup, anchor.nextSibling); top = backup.offsetTop; } return {top: top, left: left}; @@ -1740,17 +1673,19 @@ var CodeMirror = (function() { } // Coords must be lineSpace-local function coordsChar(x, y) { - if (y < 0) y = 0; var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th); + if (heightPos < 0) return {line: 0, ch: 0}; var lineNo = lineAtHeight(doc, heightPos); if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length}; var lineObj = getLine(lineNo), text = lineObj.text; var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0; if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0}; + var wrongLine = false; function getX(len) { var sp = measureLine(lineObj, len); if (tw) { var off = Math.round(sp.top / th); + wrongLine = off != innerOff; return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth); } return sp.left; @@ -1769,9 +1704,12 @@ var CodeMirror = (function() { if (estX < x) {from = estimated; fromX = estX;} // Do a binary search between these bounds. for (;;) { - if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to}; + if (to - from <= 1) { + var after = x - fromX < toX - x; + return {line: lineNo, ch: after ? from : to, after: after}; + } var middle = Math.ceil((from + to) / 2), middleX = getX(middle); - if (middleX > x) {to = middle; toX = middleX;} + if (middleX > x) {to = middle; toX = middleX; if (wrongLine) toX += 1000; } else {from = middle; fromX = middleX;} } } @@ -1780,26 +1718,32 @@ var CodeMirror = (function() { return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot}; } - var cachedHeight, cachedHeightFor, measureText; + var cachedHeight, cachedHeightFor, measurePre; function textHeight() { - if (measureText == null) { - measureText = "
";
-        for (var i = 0; i < 49; ++i) measureText += "x
"; - measureText += "x
"; + if (measurePre == null) { + measurePre = elt("pre"); + for (var i = 0; i < 49; ++i) { + measurePre.appendChild(document.createTextNode("x")); + measurePre.appendChild(elt("br")); + } + measurePre.appendChild(document.createTextNode("x")); } var offsetHeight = lineDiv.clientHeight; if (offsetHeight == cachedHeightFor) return cachedHeight; cachedHeightFor = offsetHeight; - measure.innerHTML = measureText; + removeChildrenAndAdd(measure, measurePre.cloneNode(true)); cachedHeight = measure.firstChild.offsetHeight / 50 || 1; - measure.innerHTML = ""; + removeChildren(measure); return cachedHeight; } var cachedWidth, cachedWidthFor = 0; function charWidth() { if (scroller.clientWidth == cachedWidthFor) return cachedWidth; cachedWidthFor = scroller.clientWidth; - return (cachedWidth = stringWidth("x")); + var anchor = elt("span", "x"); + var pre = elt("pre", [anchor]); + removeChildrenAndAdd(measure, pre); + return (cachedWidth = anchor.offsetWidth || 10); } function paddingTop() {return lineSpace.offsetTop;} function paddingLeft() {return lineSpace.offsetLeft;} @@ -1816,6 +1760,7 @@ var CodeMirror = (function() { var offL = eltOffset(lineSpace, true); return coordsChar(x - offL.left, y - offL.top); } + var detectingSelectAll; function onContextMenu(e) { var pos = posFromMouse(e), scrollPos = scrollbar.scrollTop; if (!pos || opera) return; // Opera is difficult. @@ -1827,19 +1772,30 @@ var CodeMirror = (function() { input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " + "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; - leaveInputAlone = true; - var val = input.value = getSelection(); focusInput(); - selectInput(input); + resetInput(true); + // Adds "Select all" to context menu in FF + if (posEq(sel.from, sel.to)) input.value = prevInput = " "; + function rehide() { - var newVal = splitLines(input.value).join("\n"); - if (newVal != val && !options.readOnly) operation(replaceSelection)(newVal, "end"); inputDiv.style.position = "relative"; input.style.cssText = oldCSS; if (ie_lt9) scrollbar.scrollTop = scrollPos; - leaveInputAlone = false; - resetInput(true); slowPoll(); + + // Try to detect the user choosing select-all + if (input.selectionStart != null) { + clearTimeout(detectingSelectAll); + var extval = input.value = " " + (posEq(sel.from, sel.to) ? "" : input.value), i = 0; + prevInput = " "; + input.selectionStart = 1; input.selectionEnd = extval.length; + detectingSelectAll = setTimeout(function poll(){ + if (prevInput == " " && input.selectionStart == 0) + operation(commands.selectAll)(instance); + else if (i++ < 10) detectingSelectAll = setTimeout(poll, 500); + else resetInput(); + }, 200); + } } if (gecko) { @@ -1860,7 +1816,7 @@ var CodeMirror = (function() { cursor.style.visibility = ""; blinker = setInterval(function() { cursor.style.visibility = (on = !on) ? "" : "hidden"; - }, 650); + }, options.cursorBlinkRate); } var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; @@ -1923,70 +1879,39 @@ var CodeMirror = (function() { return minline; } function getStateBefore(n) { - var start = findStartLine(n), state = start && getLine(start-1).stateAfter; + var pos = findStartLine(n), state = pos && getLine(pos-1).stateAfter; if (!state) state = startState(mode); else state = copyState(mode, state); - doc.iter(start, n, function(line) { - line.highlight(mode, state, options.tabSize); - line.stateAfter = copyState(mode, state); + doc.iter(pos, n, function(line) { + line.process(mode, state, options.tabSize); + line.stateAfter = (pos == n - 1 || pos % 5 == 0) ? copyState(mode, state) : null; }); - if (start < n) changes.push({from: start, to: n}); - if (n < doc.size && !getLine(n).stateAfter) work.push(n); return state; } - function highlightLines(start, end) { - var state = getStateBefore(start); - doc.iter(start, end, function(line) { - line.highlight(mode, state, options.tabSize); - line.stateAfter = copyState(mode, state); - }); - } function highlightWorker() { - var end = +new Date + options.workTime; - var foundWork = work.length; - while (work.length) { - if (!getLine(showingFrom).stateAfter) var task = showingFrom; - else var task = work.pop(); - if (task >= doc.size) continue; - var start = findStartLine(task), state = start && getLine(start-1).stateAfter; - if (state) state = copyState(mode, state); - else state = startState(mode); - - var unchanged = 0, compare = mode.compareStates, realChange = false, - i = start, bail = false; - doc.iter(i, doc.size, function(line) { - var hadState = line.stateAfter; - if (+new Date > end) { - work.push(i); - startWorker(options.workDelay); - if (realChange) changes.push({from: task, to: i + 1}); - return (bail = true); - } - var changed = line.highlight(mode, state, options.tabSize); - if (changed) realChange = true; + if (frontier >= showingTo) return; + var end = +new Date + options.workTime, state = copyState(mode, getStateBefore(frontier)); + var startFrontier = frontier; + doc.iter(frontier, showingTo, function(line) { + if (frontier >= showingFrom) { // Visible + line.highlight(mode, state, options.tabSize); line.stateAfter = copyState(mode, state); - var done = null; - if (compare) { - var same = hadState && compare(hadState, state); - if (same != Pass) done = !!same; - } - if (done == null) { - if (changed !== false || !hadState) unchanged = 0; - else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, ""))) - done = true; - } - if (done) return true; - ++i; - }); - if (bail) return; - if (realChange) changes.push({from: task, to: i + 1}); - } - if (foundWork && options.onHighlightComplete) - options.onHighlightComplete(instance); + } else { + line.process(mode, state, options.tabSize); + line.stateAfter = frontier % 5 == 0 ? copyState(mode, state) : null; + } + ++frontier; + if (+new Date > end) { + startWorker(options.workDelay); + return true; + } + }); + if (showingTo > startFrontier && frontier >= showingFrom) + operation(function() {changes.push({from: startFrontier, to: frontier});})(); } function startWorker(time) { - if (!work.length) return; - highlight.set(time, operation(highlightWorker)); + if (frontier < showingTo) + highlight.set(time, highlightWorker); } // Operations are used to wrap changes in such a way that each @@ -2000,9 +1925,11 @@ var CodeMirror = (function() { function endOperation() { if (updateMaxLine) computeMaxLength(); if (maxLineChanged && !options.lineWrapping) { - var cursorWidth = widthForcer.offsetWidth, left = stringWidth(maxLine); - widthForcer.style.left = left + "px"; - lineSpace.style.minWidth = (left + cursorWidth) + "px"; + var cursorWidth = widthForcer.offsetWidth, left = measureLine(maxLine, maxLine.text.length).left; + if (!ie_lt8) { + widthForcer.style.left = left + "px"; + lineSpace.style.minWidth = (left + cursorWidth) + "px"; + } maxLineChanged = false; } var newScrollPos, updated; @@ -2010,16 +1937,16 @@ var CodeMirror = (function() { var coords = calculateCursorCoords(); newScrollPos = calculateScrollPos(coords.x, coords.y, coords.x, coords.yBot); } - if (changes.length) updated = updateDisplay(changes, true, (newScrollPos ? newScrollPos.scrollTop : null)); - else { + if (changes.length || newScrollPos && newScrollPos.scrollTop != null) + updated = updateDisplay(changes, true, newScrollPos && newScrollPos.scrollTop); + if (!updated) { if (selectionChanged) updateSelection(); if (gutterDirty) updateGutter(); } if (newScrollPos) scrollCursorIntoView(); - if (selectionChanged) {scrollEditorIntoView(); restartBlink();} + if (selectionChanged) restartBlink(); - if (focused && !leaveInputAlone && - (updateInput === true || (updateInput !== false && selectionChanged))) + if (focused && (updateInput === true || (updateInput !== false && selectionChanged))) resetInput(userSelChange); if (selectionChanged && options.matchBrackets) @@ -2054,6 +1981,7 @@ var CodeMirror = (function() { if (extensions.propertyIsEnumerable(ext) && !instance.propertyIsEnumerable(ext)) instance[ext] = extensions[ext]; + for (var i = 0; i < initHooks.length; ++i) initHooks[i](instance); return instance; } // (end of function CodeMirror) @@ -2081,11 +2009,12 @@ var CodeMirror = (function() { dragDrop: true, onChange: null, onCursorActivity: null, + onViewportChange: null, onGutterClick: null, - onHighlightComplete: null, onUpdate: null, onFocus: null, onBlur: null, onScroll: null, matchBrackets: false, + cursorBlinkRate: 530, workTime: 100, workDelay: 200, pollInterval: 100, @@ -2124,7 +2053,13 @@ var CodeMirror = (function() { var spec = CodeMirror.resolveMode(spec); var mfactory = modes[spec.name]; if (!mfactory) return CodeMirror.getMode(options, "text/plain"); - return mfactory(options, spec); + var modeObj = mfactory(options, spec); + if (modeExtensions.hasOwnProperty(spec.name)) { + var exts = modeExtensions[spec.name]; + for (var prop in exts) if (exts.hasOwnProperty(prop)) modeObj[prop] = exts[prop]; + } + modeObj.name = spec.name; + return modeObj; }; CodeMirror.listModes = function() { var list = []; @@ -2144,6 +2079,16 @@ var CodeMirror = (function() { extensions[name] = func; }; + var initHooks = []; + CodeMirror.defineInitHook = function(f) {initHooks.push(f);}; + + var modeExtensions = CodeMirror.modeExtensions = {}; + CodeMirror.extendMode = function(mode, properties) { + var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}); + for (var prop in properties) if (properties.hasOwnProperty(prop)) + exts[prop] = properties[prop]; + }; + var commands = CodeMirror.commands = { selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});}, killLine: function(cm) { @@ -2241,6 +2186,10 @@ var CodeMirror = (function() { function lookup(map) { map = getKeyMap(map); var found = map[name]; + if (found === false) { + if (stop) stop(); + return true; + } if (found != null && handle(found)) return true; if (map.nofallthrough) { if (stop) stop(); @@ -2262,14 +2211,22 @@ var CodeMirror = (function() { var name = keyNames[e_prop(event, "keyCode")]; return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"; } + CodeMirror.isModifierKey = isModifierKey; CodeMirror.fromTextArea = function(textarea, options) { if (!options) options = {}; options.value = textarea.value; if (!options.tabindex && textarea.tabindex) options.tabindex = textarea.tabindex; - if (options.autofocus == null && textarea.getAttribute("autofocus") != null) - options.autofocus = true; + // Set autofocus to true if this textarea is focused, or if it has + // autofocus and no other element is focused. + if (options.autofocus == null) { + var hasFocus = document.body; + // doc.activeElement occasionally throws on IE + try { hasFocus = document.activeElement; } catch(e) {} + options.autofocus = hasFocus == textarea || + textarea.getAttribute("autofocus") != null && hasFocus == document.body; + } function save() {textarea.value = instance.getValue();} if (textarea.form) { @@ -2277,13 +2234,12 @@ var CodeMirror = (function() { var rmSubmit = connect(textarea.form, "submit", save, true); if (typeof textarea.form.submit == "function") { var realSubmit = textarea.form.submit; - function wrappedSubmit() { + textarea.form.submit = function wrappedSubmit() { save(); textarea.form.submit = realSubmit; textarea.form.submit(); textarea.form.submit = wrappedSubmit; - } - textarea.form.submit = wrappedSubmit; + }; } } @@ -2306,6 +2262,18 @@ var CodeMirror = (function() { return instance; }; + var gecko = /gecko\/\d{7}/i.test(navigator.userAgent); + var ie = /MSIE \d/.test(navigator.userAgent); + var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent); + var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent); + var quirksMode = ie && document.documentMode == 5; + var webkit = /WebKit\//.test(navigator.userAgent); + var chrome = /Chrome\//.test(navigator.userAgent); + var opera = /Opera\//.test(navigator.userAgent); + var safari = /Apple Computer/.test(navigator.vendor); + var khtml = /KHTML\//.test(navigator.userAgent); + var mac_geLion = /Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent); + // Utility functions for working with state. Exported because modes // sometimes need to do this. function copyState(mode, state) { @@ -2324,6 +2292,14 @@ var CodeMirror = (function() { return mode.startState ? mode.startState(a1, a2) : true; } CodeMirror.startState = startState; + CodeMirror.innerMode = function(mode, state) { + while (mode.innerMode) { + var info = mode.innerMode(state); + state = info.state; + mode = info.mode; + } + return info || {mode: mode, state: state}; + }; // The character stream used by a mode's parser. function StringStream(string, tabSize) { @@ -2334,7 +2310,7 @@ var CodeMirror = (function() { StringStream.prototype = { eol: function() {return this.pos >= this.string.length;}, sol: function() {return this.pos == 0;}, - peek: function() {return this.string.charAt(this.pos);}, + peek: function() {return this.string.charAt(this.pos) || undefined;}, next: function() { if (this.pos < this.string.length) return this.string.charAt(this.pos++); @@ -2365,13 +2341,14 @@ var CodeMirror = (function() { indentation: function() {return countColumn(this.string, null, this.tabSize);}, match: function(pattern, consume, caseInsensitive) { if (typeof pattern == "string") { - function cased(str) {return caseInsensitive ? str.toLowerCase() : str;} + var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) { if (consume !== false) this.pos += pattern.length; return true; } } else { var match = this.string.slice(this.pos).match(pattern); + if (match && match.index > 0) return null; if (match && consume !== false) this.pos += match[0].length; return match; } @@ -2380,210 +2357,174 @@ var CodeMirror = (function() { }; CodeMirror.StringStream = StringStream; - function MarkedText(from, to, className, marker) { - this.from = from; this.to = to; this.style = className; this.marker = marker; + function MarkedSpan(from, to, marker) { + this.from = from; this.to = to; this.marker = marker; } - MarkedText.prototype = { - attach: function(line) { this.marker.set.push(line); }, - detach: function(line) { - var ix = indexOf(this.marker.set, line); - if (ix > -1) this.marker.set.splice(ix, 1); - }, - split: function(pos, lenBefore) { - if (this.to <= pos && this.to != null) return null; - var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore; - var to = this.to == null ? null : this.to - pos + lenBefore; - return new MarkedText(from, to, this.style, this.marker); - }, - dup: function() { return new MarkedText(null, null, this.style, this.marker); }, - clipTo: function(fromOpen, from, toOpen, to, diff) { - if (fromOpen && to > this.from && (to < this.to || this.to == null)) - this.from = null; - else if (this.from != null && this.from >= from) - this.from = Math.max(to, this.from) + diff; - if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null)) - this.to = null; - else if (this.to != null && this.to > from) - this.to = to < this.to ? this.to + diff : from; - }, - isDead: function() { return this.from != null && this.to != null && this.from >= this.to; }, - sameSet: function(x) { return this.marker == x.marker; } - }; - function Bookmark(pos) { - this.from = pos; this.to = pos; this.line = null; - } - Bookmark.prototype = { - attach: function(line) { this.line = line; }, - detach: function(line) { if (this.line == line) this.line = null; }, - split: function(pos, lenBefore) { - if (pos < this.from) { - this.from = this.to = (this.from - pos) + lenBefore; - return this; - } - }, - isDead: function() { return this.from > this.to; }, - clipTo: function(fromOpen, from, toOpen, to, diff) { - if ((fromOpen || from < this.from) && (toOpen || to > this.to)) { - this.from = 0; this.to = -1; - } else if (this.from > from) { - this.from = this.to = Math.max(to, this.from) + diff; - } - }, - sameSet: function(x) { return false; }, - find: function() { - if (!this.line || !this.line.parent) return null; - return {line: lineNo(this.line), ch: this.from}; - }, - clear: function() { - if (this.line) { - var found = indexOf(this.line.marked, this); - if (found != -1) this.line.marked.splice(found, 1); - this.line = null; - } + function getMarkedSpanFor(spans, marker) { + if (spans) for (var i = 0; i < spans.length; ++i) { + var span = spans[i]; + if (span.marker == marker) return span; } - }; + } - // Line objects. These hold state related to a line, including - // highlighting info (the styles array). - function Line(text, styles) { - this.styles = styles || [text, null]; - this.text = text; - this.height = 1; - this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null; - this.stateAfter = this.parent = this.hidden = null; + function removeMarkedSpan(spans, span) { + var r; + for (var i = 0; i < spans.length; ++i) + if (spans[i] != span) (r || (r = [])).push(spans[i]); + return r; } - Line.inheritMarks = function(text, orig) { - var ln = new Line(text), mk = orig && orig.marked; - if (mk) { - for (var i = 0; i < mk.length; ++i) { - if (mk[i].to == null && mk[i].style) { - var newmk = ln.marked || (ln.marked = []), mark = mk[i]; - var nmark = mark.dup(); newmk.push(nmark); nmark.attach(ln); - } + + function markedSpansBefore(old, startCh, endCh) { + if (old) for (var i = 0, nw; i < old.length; ++i) { + var span = old[i], marker = span.marker; + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); + if (startsBefore || marker.type == "bookmark" && span.from == startCh && span.from != endCh) { + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh); + (nw || (nw = [])).push({from: span.from, + to: endsAfter ? null : span.to, + marker: marker}); } } - return ln; + return nw; } - Line.prototype = { - // Replace a piece of a line, keeping the styles around it intact. - replace: function(from, to_, text) { - var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_; - copyStyles(0, from, this.styles, st); - if (text) st.push(text, null); - copyStyles(to, this.text.length, this.styles, st); - this.styles = st; - this.text = this.text.slice(0, from) + text + this.text.slice(to); - this.stateAfter = null; - if (mk) { - var diff = text.length - (to - from); - for (var i = 0; i < mk.length; ++i) { - var mark = mk[i]; - mark.clipTo(from == null, from || 0, to_ == null, to, diff); - if (mark.isDead()) {mark.detach(this); mk.splice(i--, 1);} - } - } - }, - // Split a part off a line, keeping styles and markers intact. - split: function(pos, textBefore) { - var st = [textBefore, null], mk = this.marked; - copyStyles(pos, this.text.length, this.styles, st); - var taken = new Line(textBefore + this.text.slice(pos), st); - if (mk) { - for (var i = 0; i < mk.length; ++i) { - var mark = mk[i]; - var newmark = mark.split(pos, textBefore.length); - if (newmark) { - if (!taken.marked) taken.marked = []; - taken.marked.push(newmark); newmark.attach(taken); - if (newmark == mark) mk.splice(i--, 1); - } - } + + function markedSpansAfter(old, endCh) { + if (old) for (var i = 0, nw; i < old.length; ++i) { + var span = old[i], marker = span.marker; + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh); + if (endsAfter || marker.type == "bookmark" && span.from == endCh) { + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh); + (nw || (nw = [])).push({from: startsBefore ? null : span.from - endCh, + to: span.to == null ? null : span.to - endCh, + marker: marker}); } - return taken; - }, - append: function(line) { - var mylen = this.text.length, mk = line.marked, mymk = this.marked; - this.text += line.text; - copyStyles(0, line.text.length, line.styles, this.styles); - if (mymk) { - for (var i = 0; i < mymk.length; ++i) - if (mymk[i].to == null) mymk[i].to = mylen; - } - if (mk && mk.length) { - if (!mymk) this.marked = mymk = []; - outer: for (var i = 0; i < mk.length; ++i) { - var mark = mk[i]; - if (!mark.from) { - for (var j = 0; j < mymk.length; ++j) { - var mymark = mymk[j]; - if (mymark.to == mylen && mymark.sameSet(mark)) { - mymark.to = mark.to == null ? null : mark.to + mylen; - if (mymark.isDead()) { - mymark.detach(this); - mk.splice(i--, 1); - } - continue outer; - } - } - } - mymk.push(mark); - mark.attach(this); - mark.from += mylen; - if (mark.to != null) mark.to += mylen; + } + return nw; + } + + function updateMarkedSpans(oldFirst, oldLast, startCh, endCh, newText) { + if (!oldFirst && !oldLast) return newText; + // Get the spans that 'stick out' on both sides + var first = markedSpansBefore(oldFirst, startCh); + var last = markedSpansAfter(oldLast, endCh); + + // Next, merge those two ends + var sameLine = newText.length == 1, offset = lst(newText).length + (sameLine ? startCh : 0); + if (first) { + // Fix up .to properties of first + for (var i = 0; i < first.length; ++i) { + var span = first[i]; + if (span.to == null) { + var found = getMarkedSpanFor(last, span.marker); + if (!found) span.to = startCh; + else if (sameLine) span.to = found.to == null ? null : found.to + offset; } } - }, - fixMarkEnds: function(other) { - var mk = this.marked, omk = other.marked; - if (!mk) return; - outer: for (var i = 0; i < mk.length; ++i) { - var mark = mk[i], close = mark.to == null; - if (close && omk) { - for (var j = 0; j < omk.length; ++j) { - var om = omk[j]; - if (!om.sameSet(mark) || om.from != null) continue - if (mark.from == this.text.length && om.to == 0) { - omk.splice(j, 1); - mk.splice(i--, 1); - continue outer; - } else { - close = false; break; - } + } + if (last) { + // Fix up .from in last (or move them into first in case of sameLine) + for (var i = 0; i < last.length; ++i) { + var span = last[i]; + if (span.to != null) span.to += offset; + if (span.from == null) { + var found = getMarkedSpanFor(first, span.marker); + if (!found) { + span.from = offset; + if (sameLine) (first || (first = [])).push(span); } + } else { + span.from += offset; + if (sameLine) (first || (first = [])).push(span); } - if (close) mark.to = this.text.length; } - }, - fixMarkStarts: function() { - var mk = this.marked; - if (!mk) return; - for (var i = 0; i < mk.length; ++i) - if (mk[i].from == null) mk[i].from = 0; - }, - addMark: function(mark) { - mark.attach(this); - if (this.marked == null) this.marked = []; - this.marked.push(mark); - this.marked.sort(function(a, b){return (a.from || 0) - (b.from || 0);}); + } + + var newMarkers = [newHL(newText[0], first)]; + if (!sameLine) { + // Fill gap with whole-line-spans + var gap = newText.length - 2, gapMarkers; + if (gap > 0 && first) + for (var i = 0; i < first.length; ++i) + if (first[i].to == null) + (gapMarkers || (gapMarkers = [])).push({from: null, to: null, marker: first[i].marker}); + for (var i = 0; i < gap; ++i) + newMarkers.push(newHL(newText[i+1], gapMarkers)); + newMarkers.push(newHL(lst(newText), last)); + } + return newMarkers; + } + + // hl stands for history-line, a data structure that can be either a + // string (line without markers) or a {text, markedSpans} object. + function hlText(val) { return typeof val == "string" ? val : val.text; } + function hlSpans(val) { + if (typeof val == "string") return null; + var spans = val.markedSpans, out = null; + for (var i = 0; i < spans.length; ++i) { + if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } + else if (out) out.push(spans[i]); + } + return !out ? spans : out.length ? out : null; + } + function newHL(text, spans) { return spans ? {text: text, markedSpans: spans} : text; } + + function detachMarkedSpans(line) { + var spans = line.markedSpans; + if (!spans) return; + for (var i = 0; i < spans.length; ++i) { + var lines = spans[i].marker.lines; + var ix = indexOf(lines, line); + lines.splice(ix, 1); + } + line.markedSpans = null; + } + + function attachMarkedSpans(line, spans) { + if (!spans) return; + for (var i = 0; i < spans.length; ++i) + var marker = spans[i].marker.lines.push(line); + line.markedSpans = spans; + } + + // When measuring the position of the end of a line, different + // browsers require different approaches. If an empty span is added, + // many browsers report bogus offsets. Of those, some (Webkit, + // recent IE) will accept a space without moving the whole span to + // the next line when wrapping it, others work with a zero-width + // space. + var eolSpanContent = " "; + if (gecko || (ie && !ie_lt8)) eolSpanContent = "\u200b"; + else if (opera) eolSpanContent = ""; + + // Line objects. These hold state related to a line, including + // highlighting info (the styles array). + function Line(text, markedSpans) { + this.text = text; + this.height = 1; + attachMarkedSpans(this, markedSpans); + } + Line.prototype = { + update: function(text, markedSpans) { + this.text = text; + this.stateAfter = this.styles = null; + detachMarkedSpans(this); + attachMarkedSpans(this, markedSpans); }, // Run the given mode's parser over a line, update the styles // array, which contains alternating fragments of text and CSS // classes. highlight: function(mode, state, tabSize) { - var stream = new StringStream(this.text, tabSize), st = this.styles, pos = 0; - var changed = false, curWord = st[0], prevWord; + var stream = new StringStream(this.text, tabSize), st = this.styles || (this.styles = []); + var pos = st.length = 0; if (this.text == "" && mode.blankLine) mode.blankLine(state); while (!stream.eol()) { - var style = mode.token(stream, state); - var substr = this.text.slice(stream.start, stream.pos); + var style = mode.token(stream, state), substr = stream.current(); stream.start = stream.pos; - if (pos && st[pos-1] == style) + if (pos && st[pos-1] == style) { st[pos-2] += substr; - else if (substr) { - if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true; + } else if (substr) { st[pos++] = substr; st[pos++] = style; - prevWord = curWord; curWord = st[pos]; } // Give up when line is ridiculously long if (stream.pos > 5000) { @@ -2591,17 +2532,19 @@ var CodeMirror = (function() { break; } } - if (st.length != pos) {st.length = pos; changed = true;} - if (pos && st[pos-2] != prevWord) changed = true; - // Short lines with simple highlights return null, and are - // counted as changed by the driver because they are likely to - // highlight the same way in various contexts. - return changed || (st.length < 5 && this.text.length < 10 ? null : false); + }, + process: function(mode, state, tabSize) { + var stream = new StringStream(this.text, tabSize); + if (this.text == "" && mode.blankLine) mode.blankLine(state); + while (!stream.eol() && stream.pos <= 5000) { + mode.token(stream, state); + stream.start = stream.pos; + } }, // Fetch the parser token for a given character. Useful for hacks // that want to inspect the mode state (say, for completion). - getTokenAt: function(mode, state, ch) { - var txt = this.text, stream = new StringStream(txt); + getTokenAt: function(mode, state, tabSize, ch) { + var txt = this.text, stream = new StringStream(txt, tabSize); while (stream.pos < ch && !stream.eol()) { stream.start = stream.pos; var style = mode.token(stream, state); @@ -2615,94 +2558,102 @@ var CodeMirror = (function() { indentation: function(tabSize) {return countColumn(this.text, null, tabSize);}, // Produces an HTML fragment for the line, taking selection, // marking, and highlighting into account. - getHTML: function(makeTab, wrapAt, wrapId, wrapWBR) { - var html = [], first = true, col = 0; - function span_(text, style) { + getContent: function(tabSize, wrapAt, compensateForWrapping) { + var first = true, col = 0, specials = /[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g; + var pre = elt("pre"); + function span_(html, text, style) { if (!text) return; // Work around a bug where, in some compat modes, IE ignores leading spaces if (first && ie && text.charAt(0) == " ") text = "\u00a0" + text.slice(1); first = false; - if (text.indexOf("\t") == -1) { + if (!specials.test(text)) { col += text.length; - var escaped = htmlEscape(text); + var content = document.createTextNode(text); } else { - var escaped = ""; - for (var pos = 0;;) { - var idx = text.indexOf("\t", pos); - if (idx == -1) { - escaped += htmlEscape(text.slice(pos)); - col += text.length - pos; - break; + var content = document.createDocumentFragment(), pos = 0; + while (true) { + specials.lastIndex = pos; + var m = specials.exec(text); + var skipped = m ? m.index - pos : text.length - pos; + if (skipped) { + content.appendChild(document.createTextNode(text.slice(pos, pos + skipped))); + col += skipped; + } + if (!m) break; + pos += skipped + 1; + if (m[0] == "\t") { + var tabWidth = tabSize - col % tabSize; + content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")); + col += tabWidth; } else { - col += idx - pos; - var tab = makeTab(col); - escaped += htmlEscape(text.slice(pos, idx)) + tab.html; - col += tab.width; - pos = idx + 1; + var token = elt("span", "\u2022", "cm-invalidchar"); + token.title = "\\u" + m[0].charCodeAt(0).toString(16); + content.appendChild(token); + col += 1; } } } - if (style) html.push('', escaped, ""); - else html.push(escaped); + if (style) html.appendChild(elt("span", [content], style)); + else html.appendChild(content); } var span = span_; if (wrapAt != null) { - var outPos = 0, open = ""; - span = function(text, style) { + var outPos = 0, anchor = pre.anchor = elt("span"); + span = function(html, text, style) { var l = text.length; if (wrapAt >= outPos && wrapAt < outPos + l) { - if (wrapAt > outPos) { - span_(text.slice(0, wrapAt - outPos), style); + var cut = wrapAt - outPos; + if (cut) { + span_(html, text.slice(0, cut), style); // See comment at the definition of spanAffectsWrapping - if (wrapWBR) html.push(""); + if (compensateForWrapping) { + var view = text.slice(cut - 1, cut + 1); + if (spanAffectsWrapping.test(view)) html.appendChild(elt("wbr")); + else if (!ie_lt8 && /\w\w/.test(view)) html.appendChild(document.createTextNode("\u200d")); + } } - html.push(open); - var cut = wrapAt - outPos; - span_(opera ? text.slice(cut, cut + 1) : text.slice(cut), style); - html.push(""); - if (opera) span_(text.slice(cut + 1), style); + html.appendChild(anchor); + span_(anchor, opera ? text.slice(cut, cut + 1) : text.slice(cut), style); + if (opera) span_(html, text.slice(cut + 1), style); wrapAt--; outPos += l; } else { outPos += l; - span_(text, style); - // Output empty wrapper when at end of line - // (Gecko and IE8+ do strange wrapping when adding a space - // to the end of the line. Other browsers don't react well - // to zero-width spaces. So we do hideous browser sniffing - // to determine which to use.) - if (outPos == wrapAt && outPos == len) - html.push(open + (gecko || (ie && !ie_lt8) ? "​" : " ") + ""); + span_(html, text, style); + if (outPos == wrapAt && outPos == len) { + setTextContent(anchor, eolSpanContent); + html.appendChild(anchor); + } // Stop outputting HTML when gone sufficiently far beyond measure else if (outPos > wrapAt + 10 && /\s/.test(text)) span = function(){}; } - } + }; } - var st = this.styles, allText = this.text, marked = this.marked; + var st = this.styles, allText = this.text, marked = this.markedSpans; var len = allText.length; function styleToClass(style) { if (!style) return null; return "cm-" + style.replace(/ +/g, " cm-"); } - if (!allText && wrapAt == null) { - span(" "); + span(pre, " "); } else if (!marked || !marked.length) { for (var i = 0, ch = 0; ch < len; i+=2) { var str = st[i], style = st[i+1], l = str.length; if (ch + l > len) str = str.slice(0, len - ch); ch += l; - span(str, styleToClass(style)); + span(pre, str, styleToClass(style)); } } else { + marked.sort(function(a, b) { return a.from - b.from; }); var pos = 0, i = 0, text = "", style, sg = 0; var nextChange = marked[0].from || 0, marks = [], markpos = 0; - function advanceMarks() { + var advanceMarks = function() { var m; while (markpos < marked.length && ((m = marked[markpos]).from == pos || m.from == null)) { - if (m.style != null) marks.push(m); + if (m.marker.type == "range") marks.push(m); ++markpos; } nextChange = markpos < marked.length ? marked[markpos].from : Infinity; @@ -2712,7 +2663,7 @@ var CodeMirror = (function() { if (to == pos) marks.splice(i--, 1); else nextChange = Math.min(to, nextChange); } - } + }; var m = 0; while (pos < len) { if (nextChange == pos) advanceMarks(); @@ -2721,9 +2672,13 @@ var CodeMirror = (function() { if (text) { var end = pos + text.length; var appliedStyle = style; - for (var j = 0; j < marks.length; ++j) - appliedStyle = (appliedStyle ? appliedStyle + " " : "") + marks[j].style; - span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle); + for (var j = 0; j < marks.length; ++j) { + var mark = marks[j]; + appliedStyle = (appliedStyle ? appliedStyle + " " : "") + mark.marker.style; + if (mark.marker.endStyle && mark.to === Math.min(end, upto)) appliedStyle += " " + mark.marker.endStyle; + if (mark.marker.startStyle && mark.from === pos) appliedStyle += " " + mark.marker.startStyle; + } + span(pre, end > upto ? text.slice(0, upto - pos) : text, appliedStyle); if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;} pos = end; } @@ -2731,28 +2686,13 @@ var CodeMirror = (function() { } } } - return html.join(""); + return pre; }, cleanUp: function() { this.parent = null; - if (this.marked) - for (var i = 0, e = this.marked.length; i < e; ++i) this.marked[i].detach(this); + detachMarkedSpans(this); } }; - // Utility used by replace and split above - function copyStyles(from, to, source, dest) { - for (var i = 0, pos = 0, state = 0; pos < to; i+=2) { - var part = source[i], end = pos + part.length; - if (state == 0) { - if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]); - if (end >= from) state = 1; - } else if (state == 1) { - if (end > to) dest.push(part.slice(0, to - pos), source[i+1]); - else dest.push(part, source[i+1]); - } - pos = end; - } - } // Data structure that holds the sequence of lines. function LeafChunk(lines) { @@ -2953,10 +2893,10 @@ var CodeMirror = (function() { History.prototype = { addChange: function(start, added, old) { this.undone.length = 0; - var time = +new Date, cur = this.done[this.done.length - 1], last = cur && cur[cur.length - 1]; + var time = +new Date, cur = lst(this.done), last = cur && lst(cur); var dtime = time - this.time; - if (this.compound && cur && !this.closed) { + if (cur && !this.closed && this.compound) { cur.push({start: start, added: added, old: old}); } else if (dtime > 400 || !last || this.closed || last.start > start + old.length || last.start + last.added < start) { @@ -3038,30 +2978,18 @@ var CodeMirror = (function() { var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}}; - var gecko = /gecko\/\d{7}/i.test(navigator.userAgent); - var ie = /MSIE \d/.test(navigator.userAgent); - var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent); - var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent); - var quirksMode = ie && document.documentMode == 5; - var webkit = /WebKit\//.test(navigator.userAgent); - var chrome = /Chrome\//.test(navigator.userAgent); - var opera = /Opera\//.test(navigator.userAgent); - var safari = /Apple Computer/.test(navigator.vendor); - var khtml = /KHTML\//.test(navigator.userAgent); - var mac_geLion = /Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent); - // Detect drag-and-drop var dragAndDrop = function() { // There is *some* kind of drag-and-drop support in IE6-8, but I // couldn't get it to work yet. if (ie_lt9) return false; - var div = document.createElement('div'); + var div = elt('div'); return "draggable" in div || "dragDrop" in div; }(); // Feature-detect whether newlines in textareas are converted to \r\n var lineSep = function () { - var te = document.createElement("textarea"); + var te = elt("textarea"); te.value = "foo\nbar"; if (te.value.indexOf("\r") > -1) return "\r\n"; return "\n"; @@ -3093,11 +3021,6 @@ var CodeMirror = (function() { return n; } - function computedStyle(elt) { - if (elt.currentStyle) return elt.currentStyle; - return window.getComputedStyle(elt, null); - } - function eltOffset(node, screen) { // Take the parts of bounding client rect that we are interested in so we are able to edit if need be, // since the returned value cannot be changed externally (they are kept in sync as the element moves within the page) @@ -3116,10 +3039,19 @@ var CodeMirror = (function() { return box; } - // Get a node's text content. function eltText(node) { return node.textContent || node.innerText || node.nodeValue || ""; } + + var spaceStrs = [""]; + function spaceStr(n) { + while (spaceStrs.length <= n) + spaceStrs.push(lst(spaceStrs) + " "); + return spaceStrs[n]; + } + + function lst(arr) { return arr[arr.length-1]; } + function selectInput(node) { if (ios) { // Mobile Safari apparently has a bug where select() is broken. node.selectionStart = 0; @@ -3132,27 +3064,27 @@ var CodeMirror = (function() { function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);} function copyPos(x) {return {line: x.line, ch: x.ch};} - var escapeElement = document.createElement("pre"); - function htmlEscape(str) { - escapeElement.textContent = str; - return escapeElement.innerHTML; + function elt(tag, content, className, style) { + var e = document.createElement(tag); + if (className) e.className = className; + if (style) e.style.cssText = style; + if (typeof content == "string") setTextContent(e, content); + else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]); + return e; } - // Recent (late 2011) Opera betas insert bogus newlines at the start - // of the textContent, so we strip those. - if (htmlEscape("a") == "\na") { - htmlEscape = function(str) { - escapeElement.textContent = str; - return escapeElement.innerHTML.slice(1); - }; - // Some IEs don't preserve tabs through innerHTML - } else if (htmlEscape("\t") != "\t") { - htmlEscape = function(str) { - escapeElement.innerHTML = ""; - escapeElement.appendChild(document.createTextNode(str)); - return escapeElement.innerHTML; - }; + function removeChildren(e) { + e.innerHTML = ""; + return e; + } + function removeChildrenAndAdd(parent, e) { + removeChildren(parent).appendChild(e); + } + function setTextContent(e, str) { + if (ie_lt9) { + e.innerHTML = ""; + e.appendChild(document.createTextNode(str)); + } else e.textContent = str; } - CodeMirror.htmlEscape = htmlEscape; // Used to position the cursor after an undo/redo by finding the // last edited character. @@ -3171,7 +3103,7 @@ var CodeMirror = (function() { return -1; } function isWordChar(ch) { - return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase(); + return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase() || /[\u4E00-\u9FA5]/.test(ch); } // See if "".split is the broken IE version, if so, provide an @@ -3227,5 +3159,7 @@ var CodeMirror = (function() { for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i; })(); + CodeMirror.version = "2.35"; + return CodeMirror; })(); diff --git a/app/assets/lib/util/loadmode.js b/app/assets/lib/util/loadmode.js index 48d5a7abf..60fafbb17 100644 --- a/app/assets/lib/util/loadmode.js +++ b/app/assets/lib/util/loadmode.js @@ -4,7 +4,7 @@ var loading = {}; function splitCallback(cont, n) { var countDown = n; - return function() { if (--countDown == 0) cont(); } + return function() { if (--countDown == 0) cont(); }; } function ensureDeps(mode, cont) { var deps = CodeMirror.modes[mode].dependencies; diff --git a/app/assets/lib/util/multiplex.js b/app/assets/lib/util/multiplex.js index c8bb1e978..214730839 100644 --- a/app/assets/lib/util/multiplex.js +++ b/app/assets/lib/util/multiplex.js @@ -35,7 +35,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { if (found == stream.pos) { stream.match(other.open); state.innerActive = other; - state.inner = CodeMirror.startState(other.mode, outer.indent(state.outer, "")); + state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0); return other.delimStyle; } else if (found != -1 && found < cutOff) { cutOff = found; @@ -68,14 +68,10 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { return mode.indent(state.innerActive ? state.inner : state.outer, textAfter); }, - compareStates: function(a, b) { - if (a.innerActive != b.innerActive) return false; - var mode = a.innerActive || outer; - if (!mode.compareStates) return CodeMirror.Pass; - return mode.compareStates(a.innerActive ? a.inner : a.outer, - b.innerActive ? b.inner : b.outer); - }, + electricChars: outer.electricChars, - electricChars: outer.electricChars + innerMode: function(state) { + return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer}; + } }; }; diff --git a/app/assets/lib/util/overlay.js b/app/assets/lib/util/overlay.js index 1d5df6c64..fba38987b 100644 --- a/app/assets/lib/util/overlay.js +++ b/app/assets/lib/util/overlay.js @@ -47,6 +47,13 @@ CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, comb indent: base.indent && function(state, textAfter) { return base.indent(state.base, textAfter); }, - electricChars: base.electricChars + electricChars: base.electricChars, + + innerMode: function(state) { return {state: state.base, mode: base}; }, + + blankLine: function(state) { + if (base.blankLine) base.blankLine(state.base); + if (overlay.blankLine) overlay.blankLine(state.overlay); + } }; }; diff --git a/app/assets/lib/util/runmode.js b/app/assets/lib/util/runmode.js index fc58d857d..327976bad 100644 --- a/app/assets/lib/util/runmode.js +++ b/app/assets/lib/util/runmode.js @@ -1,4 +1,8 @@ CodeMirror.runMode = function(string, modespec, callback, options) { + function esc(str) { + return str.replace(/[<&]/g, function(ch) { return ch == "<" ? "<" : "&"; }); + } + var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); var isNode = callback.nodeType == 1; var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; @@ -15,12 +19,12 @@ CodeMirror.runMode = function(string, modespec, callback, options) { for (var pos = 0;;) { var idx = text.indexOf("\t", pos); if (idx == -1) { - escaped += CodeMirror.htmlEscape(text.slice(pos)); + escaped += esc(text.slice(pos)); col += text.length - pos; break; } else { col += idx - pos; - escaped += CodeMirror.htmlEscape(text.slice(pos, idx)); + escaped += esc(text.slice(pos, idx)); var size = tabSize - col % tabSize; col += size; for (var i = 0; i < size; ++i) escaped += " "; @@ -29,10 +33,10 @@ CodeMirror.runMode = function(string, modespec, callback, options) { } if (style) - accum.push("" + escaped + ""); + accum.push("" + escaped + ""); else accum.push(escaped); - } + }; } var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); for (var i = 0, e = lines.length; i < e; ++i) { diff --git a/app/assets/mode/clike/clike.js b/app/assets/mode/clike/clike.js index e0c7d18e5..69668a44d 100644 --- a/app/assets/mode/clike/clike.js +++ b/app/assets/mode/clike/clike.js @@ -140,6 +140,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { }, indent: function(state, textAfter) { + if (state.tokenize == tokenComment) return CodeMirror.Pass; if (state.tokenize != tokenBase && state.tokenize != null) return 0; var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; @@ -181,14 +182,18 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { return "string"; } - CodeMirror.defineMIME("text/x-csrc", { + function mimes(ms, mode) { + for (var i = 0; i < ms.length; ++i) CodeMirror.defineMIME(ms[i], mode); + } + + mimes(["text/x-csrc", "text/x-c", "text/x-chdr"], { name: "clike", keywords: words(cKeywords), blockKeywords: words("case do else for if switch while struct"), atoms: words("null"), hooks: {"#": cppHook} }); - CodeMirror.defineMIME("text/x-c++src", { + mimes(["text/x-c++src", "text/x-c++hdr"], { name: "clike", keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " + "static_cast typeid catch operator template typename class friend private " + diff --git a/app/assets/mode/clojure/clojure.js b/app/assets/mode/clojure/clojure.js index c68364155..84f6073fd 100644 --- a/app/assets/mode/clojure/clojure.js +++ b/app/assets/mode/clojure/clojure.js @@ -40,9 +40,9 @@ CodeMirror.defineMode("clojure", function (config, mode) { var tests = { digit: /\d/, digit_or_colon: /[\d:]/, - hex: /[0-9a-fA-F]/, + hex: /[0-9a-f]/i, sign: /[+-]/, - exponent: /[eE]/, + exponent: /e/i, keyword_char: /[^\s\(\[\;\)\]]/, basic: /[\w\$_\-]/, lang_keyword: /[\w*+!\-_?:\/]/ @@ -64,14 +64,13 @@ CodeMirror.defineMode("clojure", function (config, mode) { function isNumber(ch, stream){ // hex - if ( ch === '0' && 'x' == stream.peek().toLowerCase() ) { - stream.eat('x'); + if ( ch === '0' && stream.eat(/x/i) ) { stream.eatWhile(tests.hex); return true; } // leading sign - if ( ch == '+' || ch == '-' ) { + if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) { stream.eat(tests.sign); ch = stream.next(); } @@ -85,8 +84,7 @@ CodeMirror.defineMode("clojure", function (config, mode) { stream.eatWhile(tests.digit); } - if ( 'e' == stream.peek().toLowerCase() ) { - stream.eat(tests.exponent); + if ( stream.eat(tests.exponent) ) { stream.eat(tests.sign); stream.eatWhile(tests.digit); } @@ -145,7 +143,7 @@ CodeMirror.defineMode("clojure", function (config, mode) { } else if (isNumber(ch,stream)){ returnType = NUMBER; } else if (ch == "(" || ch == "[") { - var keyWord = ''; var indentTemp = stream.column(); + var keyWord = '', indentTemp = stream.column(), letter; /** Either (indent-word .. @@ -157,7 +155,8 @@ CodeMirror.defineMode("clojure", function (config, mode) { keyWord += letter; } - if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word + if (keyWord.length > 0 && (indentKeys.propertyIsEnumerable(keyWord) || + /^(?:def|with)/.test(keyWord))) { // indent-word pushStack(state, indentTemp + INDENT_WORD_SKIP, ch); } else { // non-indent word // we continue eating the spaces diff --git a/app/assets/mode/coffeescript/coffeescript.js b/app/assets/mode/coffeescript/coffeescript.js index d8bfe36f2..e9b97f14e 100644 --- a/app/assets/mode/coffeescript/coffeescript.js +++ b/app/assets/mode/coffeescript/coffeescript.js @@ -187,7 +187,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { } if (singleline) { if (conf.mode.singleLineStringErrors) { - outclass = ERRORCLASS + outclass = ERRORCLASS; } else { state.tokenize = tokenBase; } @@ -205,7 +205,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { } stream.eatWhile("#"); } - return "comment" + return "comment"; } function indent(stream, state, type) { @@ -244,7 +244,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { while (state.scopes[0].offset !== _indent) { state.scopes.shift(); } - return false + return false; } else { state.scopes.shift(); return false; diff --git a/app/assets/mode/commonlisp/commonlisp.js b/app/assets/mode/commonlisp/commonlisp.js new file mode 100644 index 000000000..4fb4bdf9b --- /dev/null +++ b/app/assets/mode/commonlisp/commonlisp.js @@ -0,0 +1,101 @@ +CodeMirror.defineMode("commonlisp", function (config) { + var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/; + var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/; + var symbol = /[^\s'`,@()\[\]";]/; + var type; + + function readSym(stream) { + var ch; + while (ch = stream.next()) { + if (ch == "\\") stream.next(); + else if (!symbol.test(ch)) { stream.backUp(1); break; } + } + return stream.current(); + } + + function base(stream, state) { + if (stream.eatSpace()) {type = "ws"; return null;} + if (stream.match(numLiteral)) return "number"; + var ch = stream.next(); + if (ch == "\\") ch = stream.next(); + + if (ch == '"') return (state.tokenize = inString)(stream, state); + else if (ch == "(") { type = "open"; return "bracket"; } + else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; } + else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; } + else if (/['`,@]/.test(ch)) return null; + else if (ch == "|") { + if (stream.skipTo("|")) { stream.next(); return "symbol"; } + else { stream.skipToEnd(); return "error"; } + } else if (ch == "#") { + var ch = stream.next(); + if (ch == "[") { type = "open"; return "bracket"; } + else if (/[+\-=\.']/.test(ch)) return null; + else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null; + else if (ch == "|") return (state.tokenize = inComment)(stream, state); + else if (ch == ":") { readSym(stream); return "meta"; } + else return "error"; + } else { + var name = readSym(stream); + if (name == ".") return null; + type = "symbol"; + if (name == "nil" || name == "t") return "atom"; + if (name.charAt(0) == ":") return "keyword"; + if (name.charAt(0) == "&") return "variable-2"; + return "variable"; + } + } + + function inString(stream, state) { + var escaped = false, next; + while (next = stream.next()) { + if (next == '"' && !escaped) { state.tokenize = base; break; } + escaped = !escaped && next == "\\"; + } + return "string"; + } + + function inComment(stream, state) { + var next, last; + while (next = stream.next()) { + if (next == "#" && last == "|") { state.tokenize = base; break; } + last = next; + } + type = "ws"; + return "comment"; + } + + return { + startState: function () { + return {ctx: {prev: null, start: 0, indentTo: 0}, tokenize: base}; + }, + + token: function (stream, state) { + if (stream.sol() && typeof state.ctx.indentTo != "number") + state.ctx.indentTo = state.ctx.start + 1; + + type = null; + var style = state.tokenize(stream, state); + if (type != "ws") { + if (state.ctx.indentTo == null) { + if (type == "symbol" && assumeBody.test(stream.current())) + state.ctx.indentTo = state.ctx.start + config.indentUnit; + else + state.ctx.indentTo = "next"; + } else if (state.ctx.indentTo == "next") { + state.ctx.indentTo = stream.column(); + } + } + if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null}; + else if (type == "close") state.ctx = state.ctx.prev || state.ctx; + return style; + }, + + indent: function (state, textAfter) { + var i = state.ctx.indentTo; + return typeof i == "number" ? i : state.ctx.start + 1; + } + }; +}); + +CodeMirror.defineMIME("text/x-common-lisp", "commonlisp"); diff --git a/app/assets/mode/css/css.js b/app/assets/mode/css/css.js index 050e1124c..87d5d7401 100644 --- a/app/assets/mode/css/css.js +++ b/app/assets/mode/css/css.js @@ -1,10 +1,196 @@ CodeMirror.defineMode("css", function(config) { var indentUnit = config.indentUnit, type; + + var atMediaTypes = keySet([ + "all", "aural", "braille", "handheld", "print", "projection", "screen", + "tty", "tv", "embossed" + ]); + + var atMediaFeatures = keySet([ + "width", "min-width", "max-width", "height", "min-height", "max-height", + "device-width", "min-device-width", "max-device-width", "device-height", + "min-device-height", "max-device-height", "aspect-ratio", + "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio", + "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color", + "max-color", "color-index", "min-color-index", "max-color-index", + "monochrome", "min-monochrome", "max-monochrome", "resolution", + "min-resolution", "max-resolution", "scan", "grid" + ]); + + var propertyKeywords = keySet([ + "align-content", "align-items", "align-self", "alignment-adjust", + "alignment-baseline", "anchor-point", "animation", "animation-delay", + "animation-direction", "animation-duration", "animation-iteration-count", + "animation-name", "animation-play-state", "animation-timing-function", + "appearance", "azimuth", "backface-visibility", "background", + "background-attachment", "background-clip", "background-color", + "background-image", "background-origin", "background-position", + "background-repeat", "background-size", "baseline-shift", "binding", + "bleed", "bookmark-label", "bookmark-level", "bookmark-state", + "bookmark-target", "border", "border-bottom", "border-bottom-color", + "border-bottom-left-radius", "border-bottom-right-radius", + "border-bottom-style", "border-bottom-width", "border-collapse", + "border-color", "border-image", "border-image-outset", + "border-image-repeat", "border-image-slice", "border-image-source", + "border-image-width", "border-left", "border-left-color", + "border-left-style", "border-left-width", "border-radius", "border-right", + "border-right-color", "border-right-style", "border-right-width", + "border-spacing", "border-style", "border-top", "border-top-color", + "border-top-left-radius", "border-top-right-radius", "border-top-style", + "border-top-width", "border-width", "bottom", "box-decoration-break", + "box-shadow", "box-sizing", "break-after", "break-before", "break-inside", + "caption-side", "clear", "clip", "color", "color-profile", "column-count", + "column-fill", "column-gap", "column-rule", "column-rule-color", + "column-rule-style", "column-rule-width", "column-span", "column-width", + "columns", "content", "counter-increment", "counter-reset", "crop", "cue", + "cue-after", "cue-before", "cursor", "direction", "display", + "dominant-baseline", "drop-initial-after-adjust", + "drop-initial-after-align", "drop-initial-before-adjust", + "drop-initial-before-align", "drop-initial-size", "drop-initial-value", + "elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis", + "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", + "float", "float-offset", "font", "font-feature-settings", "font-family", + "font-kerning", "font-language-override", "font-size", "font-size-adjust", + "font-stretch", "font-style", "font-synthesis", "font-variant", + "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", + "font-variant-ligatures", "font-variant-numeric", "font-variant-position", + "font-weight", "grid-cell", "grid-column", "grid-column-align", + "grid-column-sizing", "grid-column-span", "grid-columns", "grid-flow", + "grid-row", "grid-row-align", "grid-row-sizing", "grid-row-span", + "grid-rows", "grid-template", "hanging-punctuation", "height", "hyphens", + "icon", "image-orientation", "image-rendering", "image-resolution", + "inline-box-align", "justify-content", "left", "letter-spacing", + "line-break", "line-height", "line-stacking", "line-stacking-ruby", + "line-stacking-shift", "line-stacking-strategy", "list-style", + "list-style-image", "list-style-position", "list-style-type", "margin", + "margin-bottom", "margin-left", "margin-right", "margin-top", + "marker-offset", "marks", "marquee-direction", "marquee-loop", + "marquee-play-count", "marquee-speed", "marquee-style", "max-height", + "max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index", + "nav-left", "nav-right", "nav-up", "opacity", "order", "orphans", "outline", + "outline-color", "outline-offset", "outline-style", "outline-width", + "overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y", + "padding", "padding-bottom", "padding-left", "padding-right", "padding-top", + "page", "page-break-after", "page-break-before", "page-break-inside", + "page-policy", "pause", "pause-after", "pause-before", "perspective", + "perspective-origin", "pitch", "pitch-range", "play-during", "position", + "presentation-level", "punctuation-trim", "quotes", "rendering-intent", + "resize", "rest", "rest-after", "rest-before", "richness", "right", + "rotation", "rotation-point", "ruby-align", "ruby-overhang", + "ruby-position", "ruby-span", "size", "speak", "speak-as", "speak-header", + "speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set", + "tab-size", "table-layout", "target", "target-name", "target-new", + "target-position", "text-align", "text-align-last", "text-decoration", + "text-decoration-color", "text-decoration-line", "text-decoration-skip", + "text-decoration-style", "text-emphasis", "text-emphasis-color", + "text-emphasis-position", "text-emphasis-style", "text-height", + "text-indent", "text-justify", "text-outline", "text-shadow", + "text-space-collapse", "text-transform", "text-underline-position", + "text-wrap", "top", "transform", "transform-origin", "transform-style", + "transition", "transition-delay", "transition-duration", + "transition-property", "transition-timing-function", "unicode-bidi", + "vertical-align", "visibility", "voice-balance", "voice-duration", + "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress", + "voice-volume", "volume", "white-space", "widows", "width", "word-break", + "word-spacing", "word-wrap", "z-index" + ]); + + var colorKeywords = keySet([ + "black", "silver", "gray", "white", "maroon", "red", "purple", "fuchsia", + "green", "lime", "olive", "yellow", "navy", "blue", "teal", "aqua" + ]); + + var valueKeywords = keySet([ + "above", "absolute", "activeborder", "activecaption", "afar", + "after-white-space", "ahead", "alias", "all", "all-scroll", "alternate", + "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", + "arabic-indic", "armenian", "asterisks", "auto", "avoid", "background", + "backwards", "baseline", "below", "bidi-override", "binary", "bengali", + "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", + "both", "bottom", "break-all", "break-word", "button", "button-bevel", + "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", + "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", + "cell", "center", "checkbox", "circle", "cjk-earthly-branch", + "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", + "col-resize", "collapse", "compact", "condensed", "contain", "content", + "content-box", "context-menu", "continuous", "copy", "cover", "crop", + "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", + "decimal-leading-zero", "default", "default-button", "destination-atop", + "destination-in", "destination-out", "destination-over", "devanagari", + "disc", "discard", "document", "dot-dash", "dot-dot-dash", "dotted", + "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", + "element", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", + "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", + "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", + "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et", + "ethiopic-halehame-gez", "ethiopic-halehame-om-et", + "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et", + "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", + "ethiopic-halehame-tig", "ew-resize", "expanded", "extra-condensed", + "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "footnotes", + "forwards", "from", "geometricPrecision", "georgian", "graytext", "groove", + "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", + "help", "hidden", "hide", "higher", "highlight", "highlighttext", + "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore", + "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", + "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", + "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", + "italic", "justify", "kannada", "katakana", "katakana-iroha", "khmer", + "landscape", "lao", "large", "larger", "left", "level", "lighter", + "line-through", "linear", "lines", "list-item", "listbox", "listitem", + "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", + "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian", + "lower-roman", "lowercase", "ltr", "malayalam", "match", + "media-controls-background", "media-current-time-display", + "media-fullscreen-button", "media-mute-button", "media-play-button", + "media-return-to-realtime-button", "media-rewind-button", + "media-seek-back-button", "media-seek-forward-button", "media-slider", + "media-sliderthumb", "media-time-remaining-display", "media-volume-slider", + "media-volume-slider-container", "media-volume-sliderthumb", "medium", + "menu", "menulist", "menulist-button", "menulist-text", + "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", + "mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize", + "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", + "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", + "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote", + "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset", + "outside", "overlay", "overline", "padding", "padding-box", "painted", + "paused", "persian", "plus-darker", "plus-lighter", "pointer", "portrait", + "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", + "radio", "read-only", "read-write", "read-write-plaintext-only", "relative", + "repeat", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", + "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", + "s-resize", "sans-serif", "scroll", "scrollbar", "se-resize", "searchfield", + "searchfield-cancel-button", "searchfield-decoration", + "searchfield-results-button", "searchfield-results-decoration", + "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", + "single", "skip-white-space", "slide", "slider-horizontal", + "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", + "small", "small-caps", "small-caption", "smaller", "solid", "somali", + "source-atop", "source-in", "source-out", "source-over", "space", "square", + "square-button", "start", "static", "status-bar", "stretch", "stroke", + "sub", "subpixel-antialiased", "super", "sw-resize", "table", + "table-caption", "table-cell", "table-column", "table-column-group", + "table-footer-group", "table-header-group", "table-row", "table-row-group", + "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", + "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", + "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", + "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top", + "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", + "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal", + "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", + "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", + "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", + "window", "windowframe", "windowtext", "x-large", "x-small", "xor", + "xx-large", "xx-small", "yellow" + ]); + + function keySet(array) { var keys = {}; for (var i = 0; i < array.length; ++i) keys[array[i]] = true; return keys; } function ret(style, tp) {type = tp; return style;} function tokenBase(stream, state) { var ch = stream.next(); - if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());} + if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("def", stream.current());} else if (ch == "/" && stream.eat("*")) { state.tokenize = tokenCComment; return tokenCComment(stream, state); @@ -31,15 +217,29 @@ CodeMirror.defineMode("css", function(config) { stream.eatWhile(/[\w.%]/); return ret("number", "unit"); } - else if (/[,.+>*\/]/.test(ch)) { + else if (ch === "-") { + if (/\d/.test(stream.peek())) { + stream.eatWhile(/[\w.%]/); + return ret("number", "unit"); + } else if (stream.match(/^[^-]+-/)) { + return ret("meta", type); + } + } + else if (/[,+>*\/]/.test(ch)) { return ret(null, "select-op"); } - else if (/[;{}:\[\]]/.test(ch)) { + else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) { + return ret("qualifier", type); + } + else if (ch == ":") { + return ret("operator", ch); + } + else if (/[;{}\[\]\(\)]/.test(ch)) { return ret(null, ch); } else { stream.eatWhile(/[\w\\\-]/); - return ret("variable", "variable"); + return ret("property", "variable"); } } @@ -88,32 +288,156 @@ CodeMirror.defineMode("css", function(config) { }, token: function(stream, state) { + + // Use these terms when applicable (see http://www.xanthir.com/blog/b4E50) + // + // rule** or **ruleset: + // A selector + braces combo, or an at-rule. + // + // declaration block: + // A sequence of declarations. + // + // declaration: + // A property + colon + value combo. + // + // property value: + // The entire value of a property. + // + // component value: + // A single piece of a property value. Like the 5px in + // text-shadow: 0 0 5px blue;. Can also refer to things that are + // multiple terms, like the 1-4 terms that make up the background-size + // portion of the background shorthand. + // + // term: + // The basic unit of author-facing CSS, like a single number (5), + // dimension (5px), string ("foo"), or function. Officially defined + // by the CSS 2.1 grammar (look for the 'term' production) + // + // + // simple selector: + // A single atomic selector, like a type selector, an attr selector, a + // class selector, etc. + // + // compound selector: + // One or more simple selectors without a combinator. div.example is + // compound, div > .example is not. + // + // complex selector: + // One or more compound selectors chained with combinators. + // + // combinator: + // The parts of selectors that express relationships. There are four + // currently - the space (descendant combinator), the greater-than + // bracket (child combinator), the plus sign (next sibling combinator), + // and the tilda (following sibling combinator). + // + // sequence of selectors: + // One or more of the named type of selector chained with commas. + if (stream.eatSpace()) return null; var style = state.tokenize(stream, state); + // Changing style returned based on context var context = state.stack[state.stack.length-1]; - if (type == "hash" && context != "rule") style = "string-2"; - else if (style == "variable") { - if (context == "rule") style = "number"; - else if (!context || context == "@media{") style = "tag"; + if (style == "property") { + if (context == "propertyValue"){ + if (valueKeywords[stream.current()]) { + style = "string-2"; + } else if (colorKeywords[stream.current()]) { + style = "keyword"; + } else { + style = "variable-2"; + } + } else if (context == "rule") { + if (!propertyKeywords[stream.current()]) { + style += " error"; + } + } else if (!context || context == "@media{") { + style = "tag"; + } else if (context == "@media") { + if (atMediaTypes[stream.current()]) { + style = "attribute"; // Known attribute + } else if (/^(only|not)$/i.test(stream.current())) { + style = "keyword"; + } else if (stream.current().toLowerCase() == "and") { + style = "error"; // "and" is only allowed in @mediaType + } else if (atMediaFeatures[stream.current()]) { + style = "error"; // Known property, should be in @mediaType( + } else { + // Unknown, expecting keyword or attribute, assuming attribute + style = "attribute error"; + } + } else if (context == "@mediaType") { + if (atMediaTypes[stream.current()]) { + style = "attribute"; + } else if (stream.current().toLowerCase() == "and") { + style = "operator"; + } else if (/^(only|not)$/i.test(stream.current())) { + style = "error"; // Only allowed in @media + } else if (atMediaFeatures[stream.current()]) { + style = "error"; // Known property, should be in parentheses + } else { + // Unknown attribute or property, but expecting property (preceded + // by "and"). Should be in parentheses + style = "error"; + } + } else if (context == "@mediaType(") { + if (propertyKeywords[stream.current()]) { + // do nothing, remains "property" + } else if (atMediaTypes[stream.current()]) { + style = "error"; // Known property, should be in parentheses + } else if (stream.current().toLowerCase() == "and") { + style = "operator"; + } else if (/^(only|not)$/i.test(stream.current())) { + style = "error"; // Only allowed in @media + } else { + style += " error"; + } + } else { + style = "error"; + } + } else if (style == "atom") { + if(!context || context == "@media{") { + style = "builtin"; + } else if (context == "propertyValue") { + if (!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) { + style += " error"; + } + } else { + style = "error"; + } + } else if (context == "@media" && type == "{") { + style = "error"; } - if (context == "rule" && /^[\{\};]$/.test(type)) - state.stack.pop(); + // Push/pop context stack if (type == "{") { - if (context == "@media") state.stack[state.stack.length-1] = "@media{"; - else state.stack.push("{"); + if (context == "@media" || context == "@mediaType") { + state.stack.pop(); + state.stack[state.stack.length-1] = "@media{"; + } + else state.stack.push("rule"); + } + else if (type == "}") { + state.stack.pop(); + if (context == "propertyValue") state.stack.pop(); } - else if (type == "}") state.stack.pop(); else if (type == "@media") state.stack.push("@media"); - else if (context == "{" && type != "comment") state.stack.push("rule"); + else if (context == "@media" && /\b(keyword|attribute)\b/.test(style)) + state.stack.push("@mediaType"); + else if (context == "@mediaType" && stream.current() == ",") state.stack.pop(); + else if (context == "@mediaType" && type == "(") state.stack.push("@mediaType("); + else if (context == "@mediaType(" && type == ")") state.stack.pop(); + else if (context == "rule" && type == ":") state.stack.push("propertyValue"); + else if (context == "propertyValue" && type == ";") state.stack.pop(); return style; }, indent: function(state, textAfter) { var n = state.stack.length; if (/^\}/.test(textAfter)) - n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1; + n -= state.stack[state.stack.length-1] == "propertyValue" ? 2 : 1; return state.baseIndent + n * indentUnit; }, diff --git a/app/assets/mode/ecl/ecl.js b/app/assets/mode/ecl/ecl.js index 25df24ba9..c0e447927 100644 --- a/app/assets/mode/ecl/ecl.js +++ b/app/assets/mode/ecl/ecl.js @@ -49,7 +49,7 @@ CodeMirror.defineMode("ecl", function(config) { } if (/[\[\]{}\(\),;\:\.]/.test(ch)) { curPunc = ch; - return null + return null; } if (/\d/.test(ch)) { stream.eatWhile(/[\w\.]/); diff --git a/app/assets/mode/gfm/gfm.js b/app/assets/mode/gfm/gfm.js index 8f457c530..21b825939 100644 --- a/app/assets/mode/gfm/gfm.js +++ b/app/assets/mode/gfm/gfm.js @@ -1,144 +1,94 @@ CodeMirror.defineMode("gfm", function(config, parserConfig) { - var mdMode = CodeMirror.getMode(config, "markdown"); - var aliases = { - html: "htmlmixed", - js: "javascript", - json: "application/json", - c: "text/x-csrc", - "c++": "text/x-c++src", - java: "text/x-java", - csharp: "text/x-csharp", - "c#": "text/x-csharp" - }; - - // make this lazy so that we don't need to load GFM last - var getMode = (function () { - var i, modes = {}, mimes = {}, mime; - - var list = CodeMirror.listModes(); - for (i = 0; i < list.length; i++) { - modes[list[i]] = list[i]; - } - var mimesList = CodeMirror.listMIMEs(); - for (i = 0; i < mimesList.length; i++) { - mime = mimesList[i].mime; - mimes[mime] = mimesList[i].mime; - } - - for (var a in aliases) { - if (aliases[a] in modes || aliases[a] in mimes) - modes[a] = aliases[a]; - } - - return function (lang) { - return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null; - } - }()); - - function markdown(stream, state) { - // intercept fenced code blocks - if (stream.sol() && stream.match(/^```([\w+#]*)/)) { - // try switching mode - state.localMode = getMode(RegExp.$1) - if (state.localMode) - state.localState = state.localMode.startState(); - - state.token = local; - return 'code'; - } - - return mdMode.token(stream, state.mdState); - } - - function local(stream, state) { - if (stream.sol() && stream.match(/^```/)) { - state.localMode = state.localState = null; - state.token = markdown; - return 'code'; - } - else if (state.localMode) { - return state.localMode.token(stream, state.localState); - } else { - stream.skipToEnd(); - return 'code'; - } - } - - // custom handleText to prevent emphasis in the middle of a word - // and add autolinking - function handleText(stream, mdState) { - var match; - if (stream.match(/^\w+:\/\/\S+/)) { - return 'link'; - } - if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) { - return mdMode.getType(mdState); - } - if (match = stream.match(/^[^\[*\\<>` ]+/)) { - var word = match[0]; - if (word[0] === '_' && word[word.length-1] === '_') { - stream.backUp(word.length); - return undefined; - } - return mdMode.getType(mdState); - } - if (stream.eatSpace()) { - return null; - } + var codeDepth = 0; + function blankLine(state) { + state.code = false; + return null; } - - return { + var gfmOverlay = { startState: function() { - var mdState = mdMode.startState(); - mdState.text = handleText; - return {token: markdown, mode: "markdown", mdState: mdState, - localMode: null, localState: null}; + return { + code: false, + codeBlock: false, + ateSpace: false + }; }, - - copyState: function(state) { - return {token: state.token, mode: state.mode, mdState: CodeMirror.copyState(mdMode, state.mdState), - localMode: state.localMode, - localState: state.localMode ? CodeMirror.copyState(state.localMode, state.localState) : null}; + copyState: function(s) { + return { + code: s.code, + codeBlock: s.codeBlock, + ateSpace: s.ateSpace + }; }, - token: function(stream, state) { - /* Parse GFM double bracket links */ - if ((ch = stream.peek()) != undefined && ch == '[') { - stream.next(); // Advance the stream - - /* Only handle double bracket links */ - if ((ch = stream.peek()) == undefined || ch != '[') { - stream.backUp(1); - return state.token(stream, state); - } - - while ((ch = stream.next()) != undefined && ch != ']') {} - - if (ch == ']' && (ch = stream.next()) != undefined && ch == ']') - return 'link'; - - /* If we did not find the second ']' */ - stream.backUp(1); + // Hack to prevent formatting override inside code blocks (block and inline) + if (state.codeBlock) { + if (stream.match(/^```/)) { + state.codeBlock = false; + return null; } - - /* Match GFM latex formulas, as well as latex formulas within '$' */ - if (stream.match(/^\$[^\$]+\$/)) { - return "string"; - } - - if (stream.match(/^\\\((.*?)\\\)/)) { - return "string"; - } - - if (stream.match(/^\$\$[^\$]+\$\$/)) { - return "string"; + stream.skipToEnd(); + return null; + } + if (stream.sol()) { + state.code = false; + } + if (stream.sol() && stream.match(/^```/)) { + stream.skipToEnd(); + state.codeBlock = true; + return null; + } + // If this block is changed, it may need to be updated in Markdown mode + if (stream.peek() === '`') { + stream.next(); + var before = stream.pos; + stream.eatWhile('`'); + var difference = 1 + stream.pos - before; + if (!state.code) { + codeDepth = difference; + state.code = true; + } else { + if (difference === codeDepth) { // Must be exact + state.code = false; + } } - - if (stream.match(/^\\\[(.*?)\\\]/)) { - return "string"; + return null; + } else if (state.code) { + stream.next(); + return null; + } + // Check if space. If so, links can be formatted later on + if (stream.eatSpace()) { + state.ateSpace = true; + return null; + } + if (stream.sol() || state.ateSpace) { + state.ateSpace = false; + if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) { + // User/Project@SHA + // User@SHA + // SHA + return "link"; + } else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) { + // User/Project#Num + // User#Num + // #Num + return "link"; } - - return state.token(stream, state); - } - } -}, "markdown"); + } + if (stream.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i)) { + // URLs + // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls + return "link"; + } + stream.next(); + return null; + }, + blankLine: blankLine + }; + CodeMirror.defineMIME("gfmBase", { + name: "markdown", + underscoresBreakWords: false, + fencedCodeBlocks: true + }); + return CodeMirror.overlayMode(CodeMirror.getMode(config, "gfmBase"), gfmOverlay); +}); diff --git a/app/assets/mode/go/go.js b/app/assets/mode/go/go.js index 657c014a9..9863bbf04 100644 --- a/app/assets/mode/go/go.js +++ b/app/assets/mode/go/go.js @@ -47,7 +47,7 @@ CodeMirror.defineMode("go", function(config, parserConfig) { } if (/[\[\]{}\(\),;\:\.]/.test(ch)) { curPunc = ch; - return null + return null; } if (ch == "/") { if (stream.eat("*")) { @@ -144,7 +144,7 @@ CodeMirror.defineMode("go", function(config, parserConfig) { if (curPunc == "{") pushContext(state, stream.column(), "}"); else if (curPunc == "[") pushContext(state, stream.column(), "]"); else if (curPunc == "(") pushContext(state, stream.column(), ")"); - else if (curPunc == "case") ctx.type = "case" + else if (curPunc == "case") ctx.type = "case"; else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state); else if (curPunc == ctx.type) popContext(state); state.startOfLine = false; diff --git a/app/assets/mode/groovy/groovy.js b/app/assets/mode/groovy/groovy.js index a7daadb5d..752bc2f7d 100644 --- a/app/assets/mode/groovy/groovy.js +++ b/app/assets/mode/groovy/groovy.js @@ -21,7 +21,7 @@ CodeMirror.defineMode("groovy", function(config, parserConfig) { } if (/[\[\]{}\(\),;\:\.]/.test(ch)) { curPunc = ch; - return null + return null; } if (/\d/.test(ch)) { stream.eatWhile(/[\w\.]/); diff --git a/app/assets/mode/haskell/haskell.js b/app/assets/mode/haskell/haskell.js index aac504108..e15a32cdf 100644 --- a/app/assets/mode/haskell/haskell.js +++ b/app/assets/mode/haskell/haskell.js @@ -128,7 +128,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) { } setState(ncomment(type, currNest)); return type; - } + }; } function stringLiteral(source, setState) { @@ -170,7 +170,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) { return function () { for (var i = 0; i < arguments.length; i++) wkw[arguments[i]] = t; - } + }; } setType("keyword")( diff --git a/app/assets/mode/haxe/haxe.js b/app/assets/mode/haxe/haxe.js index ef78974da..64f4eb3ff 100644 --- a/app/assets/mode/haxe/haxe.js +++ b/app/assets/mode/haxe/haxe.js @@ -6,7 +6,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) { var keywords = function(){ function kw(type) {return {type: type, style: "keyword"};} var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); - var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"} + var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"}; var type = kw("typedef"); return { "if": A, "while": A, "else": B, "do": B, "try": B, @@ -219,7 +219,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) { function pushlex(type, info) { var result = function() { var state = cx.state; - state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info) + state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info); }; result.lex = true; return result; @@ -243,7 +243,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) { } function statement(type) { - if (type == "@") return cont(metadef) + if (type == "@") return cont(metadef); if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex); if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex); if (type == "keyword b") return cont(pushlex("form"), statement, poplex); @@ -297,7 +297,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) { function metadef(type, value) { if(type == ":") return cont(metadef); if(type == "variable") return cont(metadef); - if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement) + if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement); } function metaargs(type, value) { if(typ == "variable") return cont(); @@ -421,9 +421,6 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) { else if (lexical.align) return lexical.column + (closing ? 0 : 1); else return lexical.indented + (closing ? 0 : indentUnit); }, - compareStates: function(state1, state2) { - return (state1.localVars == state2.localVars) && (state1.context == state2.context); - }, electricChars: "{}" }; diff --git a/app/assets/mode/htmlembedded/htmlembedded.js b/app/assets/mode/htmlembedded/htmlembedded.js index 1773aeb5c..b7888689f 100644 --- a/app/assets/mode/htmlembedded/htmlembedded.js +++ b/app/assets/mode/htmlembedded/htmlembedded.js @@ -36,7 +36,7 @@ CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch, htmlState : htmlMixedMode.startState(), scriptState : scriptingMode.startState() - } + }; }, token: function(stream, state) { @@ -55,14 +55,19 @@ CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { token : state.token, htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState), scriptState : CodeMirror.copyState(scriptingMode, state.scriptState) - } + }; }, + electricChars: "/{}:", - electricChars: "/{}:" - } + innerMode: function(state) { + if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode}; + else return {state: state.htmlState, mode: htmlMixedMode}; + } + }; }, "htmlmixed"); CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"}); CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"}); +CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"}); diff --git a/app/assets/mode/htmlmixed/htmlmixed.js b/app/assets/mode/htmlmixed/htmlmixed.js index a6c62c9d0..465284829 100644 --- a/app/assets/mode/htmlmixed/htmlmixed.js +++ b/app/assets/mode/htmlmixed/htmlmixed.js @@ -1,4 +1,4 @@ -CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { +CodeMirror.defineMode("htmlmixed", function(config) { var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true}); var jsMode = CodeMirror.getMode(config, "javascript"); var cssMode = CodeMirror.getMode(config, "css"); @@ -9,27 +9,28 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { if (/^script$/i.test(state.htmlState.context.tagName)) { state.token = javascript; state.localState = jsMode.startState(htmlMode.indent(state.htmlState, "")); - state.mode = "javascript"; } else if (/^style$/i.test(state.htmlState.context.tagName)) { state.token = css; state.localState = cssMode.startState(htmlMode.indent(state.htmlState, "")); - state.mode = "css"; } } return style; } function maybeBackup(stream, pat, style) { var cur = stream.current(); - var close = cur.search(pat); + var close = cur.search(pat), m; if (close > -1) stream.backUp(cur.length - close); + else if (m = cur.match(/<\/?$/)) { + stream.backUp(cur[0].length); + if (!stream.match(pat, false)) stream.match(cur[0]); + } return style; } function javascript(stream, state) { if (stream.match(/^<\/\s*script\s*>/i, false)) { state.token = html; state.localState = null; - state.mode = "html"; return html(stream, state); } return maybeBackup(stream, /<\/\s*script\s*>/, @@ -39,7 +40,6 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { if (stream.match(/^<\/\s*style\s*>/i, false)) { state.token = html; state.localState = null; - state.mode = "html"; return html(stream, state); } return maybeBackup(stream, /<\/\s*style\s*>/, @@ -72,14 +72,13 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { return cssMode.indent(state.localState, textAfter); }, - compareStates: function(a, b) { - if (a.mode != b.mode) return false; - if (a.localState) return CodeMirror.Pass; - return htmlMode.compareStates(a.htmlState, b.htmlState); - }, + electricChars: "/{}:", - electricChars: "/{}:" - } + innerMode: function(state) { + var mode = state.token == html ? htmlMode : state.token == javascript ? jsMode : cssMode; + return {state: state.localState || state.htmlState, mode: mode}; + } + }; }, "xml", "javascript", "css"); CodeMirror.defineMIME("text/html", "htmlmixed"); diff --git a/app/assets/mode/javascript/javascript.js b/app/assets/mode/javascript/javascript.js index 65f11c5bf..37f6f8737 100644 --- a/app/assets/mode/javascript/javascript.js +++ b/app/assets/mode/javascript/javascript.js @@ -1,6 +1,9 @@ +// TODO actually recognize syntax of TypeScript constructs + CodeMirror.defineMode("javascript", function(config, parserConfig) { var indentUnit = config.indentUnit; var jsonMode = parserConfig.json; + var isTS = parserConfig.typescript; // Tokenizer @@ -8,7 +11,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function kw(type) {return {type: type, style: "keyword"};} var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); var operator = kw("operator"), atom = {type: "atom", style: "atom"}; - return { + + var jsKeywords = { "if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, "var": kw("var"), "const": kw("var"), "let": kw("var"), @@ -17,6 +21,35 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { "in": operator, "typeof": operator, "instanceof": operator, "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom }; + + // Extend the 'normal' keywords with the TypeScript language extensions + if (isTS) { + var type = {type: "variable", style: "variable-3"}; + var tsKeywords = { + // object-like things + "interface": kw("interface"), + "class": kw("class"), + "extends": kw("extends"), + "constructor": kw("constructor"), + + // scope modifiers + "public": kw("public"), + "private": kw("private"), + "protected": kw("protected"), + "static": kw("static"), + + "super": kw("super"), + + // types + "string": type, "number": type, "bool": type, "any": type + }; + + for (var attr in tsKeywords) { + jsKeywords[attr] = tsKeywords[attr]; + } + } + + return jsKeywords; }(); var isOperatorChar = /[+\-*&%=<>!?|]/; @@ -66,7 +99,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { stream.skipToEnd(); return ret("comment", "comment"); } - else if (state.reAllowed) { + else if (state.lastType == "operator" || state.lastType == "keyword c" || + /^[\[{}\(,;:]$/.test(state.lastType)) { nextUntilUnescaped(stream, "/"); stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla return ret("regexp", "string-2"); @@ -87,7 +121,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { else { stream.eatWhile(/[\w\$_]/); var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; - return (known && state.kwAllowed) ? ret(known.type, known.style, word) : + return (known && state.lastType != ".") ? ret(known.type, known.style, word) : ret("variable", "variable", word); } } @@ -175,8 +209,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var defaultVars = {name: "this", next: {name: "arguments"}}; function pushcontext() { - if (!cx.state.context) cx.state.localVars = defaultVars; cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; + cx.state.localVars = defaultVars; } function popcontext() { cx.state.localVars = cx.state.context.vars; @@ -185,7 +219,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function pushlex(type, info) { var result = function() { var state = cx.state; - state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info) + state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info); }; result.lex = true; return result; @@ -243,7 +277,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function maybeoperator(type, value) { if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator); - if (type == "operator" || type == ":") return cont(expression); + if (type == "operator" && value == "?") return cont(expression, expect(":"), expression); if (type == ";") return; if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator); if (type == ".") return cont(property, maybeoperator); @@ -275,19 +309,30 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "}") return cont(); return pass(statement, block); } + function maybetype(type) { + if (type == ":") return cont(typedef); + return pass(); + } + function typedef(type) { + if (type == "variable"){cx.marked = "variable-3"; return cont();} + return pass(); + } function vardef1(type, value) { - if (type == "variable"){register(value); return cont(vardef2);} - return cont(); + if (type == "variable") { + register(value); + return isTS ? cont(maybetype, vardef2) : cont(vardef2); + } + return pass(); } function vardef2(type, value) { if (value == "=") return cont(expression, vardef2); if (type == ",") return cont(vardef1); } function forspec1(type) { - if (type == "var") return cont(vardef1, forspec2); - if (type == ";") return pass(forspec2); + if (type == "var") return cont(vardef1, expect(";"), forspec2); + if (type == ";") return cont(forspec2); if (type == "variable") return cont(formaybein); - return pass(forspec2); + return cont(forspec2); } function formaybein(type, value) { if (value == "in") return cont(expression); @@ -306,7 +351,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext); } function funarg(type, value) { - if (type == "variable") {register(value); return cont();} + if (type == "variable") {register(value); return isTS ? cont(maybetype) : cont();} } // Interface @@ -315,8 +360,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { startState: function(basecolumn) { return { tokenize: jsTokenBase, - reAllowed: true, - kwAllowed: true, + lastType: null, cc: [], lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), localVars: parserConfig.localVars, @@ -334,19 +378,21 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (stream.eatSpace()) return null; var style = state.tokenize(stream, state); if (type == "comment") return style; - state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/)); - state.kwAllowed = type != '.'; + state.lastType = type; return parseJS(state, style, type, content, stream); }, indent: function(state, textAfter) { + if (state.tokenize == jsTokenComment) return CodeMirror.Pass; if (state.tokenize != jsTokenBase) return 0; var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; var type = lexical.type, closing = firstChar == type; - if (type == "vardef") return lexical.indented + 4; + if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? 4 : 0); else if (type == "form" && firstChar == "{") return lexical.indented; - else if (type == "stat" || type == "form") return lexical.indented + indentUnit; + else if (type == "form") return lexical.indented + indentUnit; + else if (type == "stat") + return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? indentUnit : 0); else if (lexical.info == "switch" && !closing) return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); else if (lexical.align) return lexical.column + (closing ? 0 : 1); @@ -359,3 +405,5 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { CodeMirror.defineMIME("text/javascript", "javascript"); CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); +CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); +CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); diff --git a/app/assets/mode/less/less.js b/app/assets/mode/less/less.js index e80beb149..70cd5c937 100644 --- a/app/assets/mode/less/less.js +++ b/app/assets/mode/less/less.js @@ -1,25 +1,24 @@ /* LESS mode - http://www.lesscss.org/ - Ported to CodeMirror by Peter Kroon + Ported to CodeMirror by Peter Kroon + Report bugs/issues here: https://github.com/marijnh/CodeMirror/issues GitHub: @peterkroon */ CodeMirror.defineMode("less", function(config) { var indentUnit = config.indentUnit, type; function ret(style, tp) {type = tp; return style;} - //html5 tags - var tags = ["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr"]; + //html tags + var tags = "a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br button canvas caption cite code col colgroup command datalist dd del details dfn dir div dl dt em embed fieldset figcaption figure font footer form frame frameset h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins keygen kbd label legend li link map mark menu meta meter nav noframes noscript object ol optgroup option output p param pre progress q rp rt ruby s samp script section select small source span strike strong style sub summary sup table tbody td textarea tfoot th thead time title tr track tt u ul var video wbr".split(' '); function inTagsArray(val){ - for(var i=0; i*\/]/.test(ch)) {//removed . dot character original was [,.+>*\/] + else if (/[,+<>*\/]/.test(ch)) { + if(stream.peek() == "=" || type == "a")return ret("string", "string"); return ret(null, "select-op"); } - else if (/[;{}:\[\]()]/.test(ch)) { //added () char for lesscss original was [;{}:\[\]] - if(ch == ":"){ - stream.eatWhile(/[active|hover|link|visited]/); - if( stream.current().match(/active|hover|link|visited/)){ + else if (/[;{}:\[\]()~\|]/.test(ch)) { + if(ch == ":"){ + stream.eatWhile(/[a-z\\\-]/); + if( selectors.test(stream.current()) ){ return ret("tag", "tag"); + }else if(stream.peek() == ":"){//::-webkit-search-decoration + stream.next(); + stream.eatWhile(/[a-z\\\-]/); + if(stream.current().match(/\:\:\-(o|ms|moz|webkit)\-/))return ret("string", "string"); + if( selectors.test(stream.current().substring(1)) )return ret("tag", "tag"); + return ret(null, ch); }else{ return ret(null, ch); } + }else if(ch == "~"){ + if(type == "r")return ret("string", "string"); }else{ return ret(null, ch); } } - else if (ch == ".") { // lesscss + else if (ch == ".") { + if(type == "(" || type == "string")return ret("string", "string"); // allow url(../image.png) stream.eatWhile(/[\a-zA-Z0-9\-_]/); + if(stream.peek() == " ")stream.eatSpace(); + if(stream.peek() == ")")return ret("number", "unit");//rgba(0,0,0,.25); return ret("tag", "tag"); } - else if (ch == "#") { // lesscss + else if (ch == "#") { //we don't eat white-space, we want the hex color and or id only stream.eatWhile(/[A-Za-z0-9]/); //check if there is a proper hex color length e.g. #eee || #eeeEEE - if(stream.current().length ===4 || stream.current().length ===7){ + if(stream.current().length == 4 || stream.current().length == 7){ if(stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false) != null){//is there a valid hex color value present in the current stream //when not a valid hex value, parse as id if(stream.current().substring(1) != stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false))return ret("atom", "tag"); @@ -96,8 +108,8 @@ CodeMirror.defineMode("less", function(config) { stream.eatWhile(/[\w\\\-]/); return ret("atom", "tag"); } - }else{ - stream.eatWhile(/[\w\\\-]/); + }else{//when not a valid hexvalue length + stream.eatWhile(/[\w\\\-]/); return ret("atom", "tag"); } } @@ -107,39 +119,62 @@ CodeMirror.defineMode("less", function(config) { } else { stream.eatWhile(/[\w\\\-_%.{]/); - if(stream.current().match(/http|https/) != null){ + if(type == "string"){ + return ret("string", "string"); + }else if(stream.current().match(/(^http$|^https$)/) != null){ stream.eatWhile(/[\w\\\-_%.{:\/]/); return ret("string", "string"); }else if(stream.peek() == "<" || stream.peek() == ">"){ return ret("tag", "tag"); - }else if( stream.peek().match(/\(/) != null ){// lessc + }else if( /\(/.test(stream.peek()) ){ return ret(null, ch); }else if (stream.peek() == "/" && state.stack[state.stack.length-1] != undefined){ // url(dir/center/image.png) return ret("string", "string"); - }else if( stream.current().match(/\-\d|\-.\d/) ){ // lesscss match e.g.: -5px -0.4 etc... only colorize the minus sign - //stream.backUp(stream.current().length-1); //commment out these 2 comment if you want the minus sign to be parsed as null -500px - //return ret(null, ch); + }else if( stream.current().match(/\-\d|\-.\d/) ){ // match e.g.: -5px -0.4 etc... only colorize the minus sign + //commment out these 2 comment if you want the minus sign to be parsed as null -500px + //stream.backUp(stream.current().length-1); + //return ret(null, ch); //console.log( stream.current() ); return ret("number", "unit"); - }else if( inTagsArray(stream.current()) ){ // lesscss match html tags + }else if( inTagsArray(stream.current().toLowerCase()) ){ // match html tags return ret("tag", "tag"); }else if( /\/|[\s\)]/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == "/")) && stream.current().indexOf(".") !== -1){ - if(stream.current().substring(stream.current().length-1,stream.current().length) == "{"){ - stream.backUp(1); - return ret("tag", "tag"); - }//end if - if( (stream.eatSpace() && stream.peek().match(/[{<>.a-zA-Z]/) != null) || stream.eol() )return ret("tag", "tag");//e.g. button.icon-plus - return ret("string", "string");//let url(/images/logo.png) without quotes return as string - }else if( stream.eol() ){ - if(stream.current().substring(stream.current().length-1,stream.current().length) == "{")stream.backUp(1); - return ret("tag", "tag"); - }else{ - return ret("variable", "variable"); + if(stream.current().substring(stream.current().length-1,stream.current().length) == "{"){ + stream.backUp(1); + return ret("tag", "tag"); + }//end if + stream.eatSpace(); + if( /[{<>.a-zA-Z\/]/.test(stream.peek()) || stream.eol() )return ret("tag", "tag"); // e.g. button.icon-plus + return ret("string", "string"); // let url(/images/logo.png) without quotes return as string + }else if( stream.eol() || stream.peek() == "[" || stream.peek() == "#" || type == "tag" ){ + if(stream.current().substring(stream.current().length-1,stream.current().length) == "{")stream.backUp(1); + return ret("tag", "tag"); + }else if(type == "compare" || type == "a" || type == "("){ + return ret("string", "string"); + }else if(type == "|" || stream.current() == "-" || type == "["){ + return ret(null, ch); + }else if(stream.peek() == ":") { + stream.next(); + var t_v = stream.peek() == ":" ? true : false; + if(!t_v){ + var old_pos = stream.pos; + var sc = stream.current().length; + stream.eatWhile(/[a-z\\\-]/); + var new_pos = stream.pos; + if(stream.current().substring(sc-1).match(selectors) != null){ + stream.backUp(new_pos-(old_pos-1)); + return ret("tag", "tag"); + } else stream.backUp(new_pos-(old_pos-1)); + }else{ + stream.backUp(1); + } + if(t_v)return ret("tag", "tag"); else return ret("variable", "variable"); + }else{ + return ret("variable", "variable"); } - } - + } } - - function tokenSComment(stream, state) {// SComment = Slash comment + + function tokenSComment(stream, state) { // SComment = Slash comment stream.skipToEnd(); state.tokenize = tokenBase; return ret("comment", "comment"); @@ -156,7 +191,7 @@ CodeMirror.defineMode("less", function(config) { } return ret("comment", "comment"); } - + function tokenSGMLComment(stream, state) { var dashes = 0, ch; while ((ch = stream.next()) != null) { @@ -168,7 +203,7 @@ CodeMirror.defineMode("less", function(config) { } return ret("comment", "comment"); } - + function tokenString(quote) { return function(stream, state) { var escaped = false, ch; @@ -181,29 +216,28 @@ CodeMirror.defineMode("less", function(config) { return ret("string", "string"); }; } - + return { startState: function(base) { return {tokenize: tokenBase, baseIndent: base || 0, stack: []}; }, - + token: function(stream, state) { if (stream.eatSpace()) return null; var style = state.tokenize(stream, state); - + var context = state.stack[state.stack.length-1]; if (type == "hash" && context == "rule") style = "atom"; else if (style == "variable") { if (context == "rule") style = null; //"tag" - else if (!context || context == "@media{"){ - style = stream.current() == "when" ? "variable" : - stream.string.match(/#/g) != undefined ? null : - /[\s,|\s\)]/.test(stream.peek()) ? "tag" : null; - } + else if (!context || context == "@media{") { + style = stream.current() == "when" ? "variable" : + /[\s,|\s\)|\s]/.test(stream.peek()) ? "tag" : type; + } } - + if (context == "rule" && /^[\{\};]$/.test(type)) state.stack.pop(); if (type == "{") { @@ -215,18 +249,18 @@ CodeMirror.defineMode("less", function(config) { else if (context == "{" && type != "comment") state.stack.push("rule"); return style; }, - + indent: function(state, textAfter) { var n = state.stack.length; if (/^\}/.test(textAfter)) n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1; return state.baseIndent + n * indentUnit; }, - + electricChars: "}" }; }); CodeMirror.defineMIME("text/x-less", "less"); if (!CodeMirror.mimeModes.hasOwnProperty("text/css")) - CodeMirror.defineMIME("text/css", "less"); + CodeMirror.defineMIME("text/css", "less"); \ No newline at end of file diff --git a/app/assets/mode/lua/lua.js b/app/assets/mode/lua/lua.js index 60e84a926..97fb2c6f9 100644 --- a/app/assets/mode/lua/lua.js +++ b/app/assets/mode/lua/lua.js @@ -64,7 +64,7 @@ CodeMirror.defineMode("lua", function(config, parserConfig) { function normal(stream, state) { var ch = stream.next(); if (ch == "-" && stream.eat("-")) { - if (stream.eat("[")) + if (stream.eat("[") && stream.eat("[")) return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state); stream.skipToEnd(); return "comment"; diff --git a/app/assets/mode/markdown/markdown.js b/app/assets/mode/markdown/markdown.js index e3d5676c0..d227fc9b9 100644 --- a/app/assets/mode/markdown/markdown.js +++ b/app/assets/mode/markdown/markdown.js @@ -2,12 +2,59 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { var htmlFound = CodeMirror.mimeModes.hasOwnProperty("text/html"); var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? "text/html" : "text/plain"); + var aliases = { + html: "htmlmixed", + js: "javascript", + json: "application/json", + c: "text/x-csrc", + "c++": "text/x-c++src", + java: "text/x-java", + csharp: "text/x-csharp", + "c#": "text/x-csharp" + }; + + var getMode = (function () { + var i, modes = {}, mimes = {}, mime; + + var list = CodeMirror.listModes(); + for (i = 0; i < list.length; i++) { + modes[list[i]] = list[i]; + } + var mimesList = CodeMirror.listMIMEs(); + for (i = 0; i < mimesList.length; i++) { + mime = mimesList[i].mime; + mimes[mime] = mimesList[i].mime; + } + + for (var a in aliases) { + if (aliases[a] in modes || aliases[a] in mimes) + modes[a] = aliases[a]; + } + + return function (lang) { + return modes[lang] ? CodeMirror.getMode(cmCfg, modes[lang]) : null; + }; + }()); + + // Should underscores in words open/close em/strong? + if (modeCfg.underscoresBreakWords === undefined) + modeCfg.underscoresBreakWords = true; + + // Turn on fenced code blocks? ("```" to start/end) + if (modeCfg.fencedCodeBlocks === undefined) modeCfg.fencedCodeBlocks = false; + + var codeDepth = 0; + var prevLineHasContent = false + , thisLineHasContent = false; var header = 'header' , code = 'comment' , quote = 'quote' , list = 'string' , hr = 'hr' + , image = 'tag' + , linkinline = 'link' + , linkemail = 'link' , linktext = 'link' , linkhref = 'string' , em = 'em' @@ -17,8 +64,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/ , ulRE = /^[*\-+]\s+/ , olRE = /^[0-9]+\.\s+/ - , headerRE = /^(?:\={3,}|-{3,})$/ - , textRE = /^[^\[*_\\<>`]+/; + , headerRE = /^(?:\={1,}|-{1,})$/ + , textRE = /^[^!\[\]*_\\<>` "'(]+/; function switchInline(stream, state, f) { state.f = state.inline = f; @@ -34,10 +81,14 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { // Blocks function blankLine(state) { + // Reset linkTitle state + state.linkTitle = false; // Reset EM state state.em = false; // Reset STRONG state state.strong = false; + // Reset state.quote + state.quote = false; if (!htmlFound && state.f == htmlBlock) { state.f = inlineNormal; state.block = blockNormal; @@ -46,14 +97,23 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { } function blockNormal(stream, state) { - var match; + + if (state.list !== false && state.indentationDiff >= 0) { // Continued list + if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block + state.indentation -= state.indentationDiff; + } + state.list = null; + } else { // No longer a list + state.list = false; + } + if (state.indentationDiff >= 4) { - state.indentation -= state.indentationDiff; + state.indentation -= 4; stream.skipToEnd(); return code; } else if (stream.eatSpace()) { return null; - } else if (stream.peek() === '#' || stream.match(headerRE)) { + } else if (stream.peek() === '#' || (prevLineHasContent && stream.match(headerRE)) ) { state.header = true; } else if (stream.eat('>')) { state.indentation++; @@ -62,9 +122,15 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { return switchInline(stream, state, footnoteLink); } else if (stream.match(hrRE, true)) { return hr; - } else if (match = stream.match(ulRE, true) || stream.match(olRE, true)) { - state.indentation += match[0].length; - return list; + } else if (stream.match(ulRE, true) || stream.match(olRE, true)) { + state.indentation += 4; + state.list = true; + } else if (modeCfg.fencedCodeBlocks && stream.match(/^```([\w+#]*)/, true)) { + // try switching mode + state.localMode = getMode(RegExp.$1); + if (state.localMode) state.localState = state.localMode.startState(); + switchBlock(stream, state, local); + return code; } return switchInline(stream, state, state.inline); @@ -84,6 +150,30 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { return style; } + function local(stream, state) { + if (stream.sol() && stream.match(/^```/, true)) { + state.localMode = state.localState = null; + state.f = inlineNormal; + state.block = blockNormal; + return code; + } else if (state.localMode) { + return state.localMode.token(stream, state.localState); + } else { + stream.skipToEnd(); + return code; + } + } + + function codeBlock(stream, state) { + if(stream.match(codeBlockRE, true)){ + state.f = inlineNormal; + state.block = blockNormal; + switchInline(stream, state, state.inline); + return code; + } + stream.skipToEnd(); + return code; + } // Inline function getType(state) { @@ -92,8 +182,13 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { if (state.strong) { styles.push(state.em ? emstrong : strong); } else if (state.em) { styles.push(em); } + if (state.linkText) { styles.push(linktext); } + + if (state.code) { styles.push(code); } + if (state.header) { styles.push(header); } if (state.quote) { styles.push(quote); } + if (state.list !== false) { styles.push(list); } return styles.length ? styles.join(' ') : null; } @@ -106,22 +201,83 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { } function inlineNormal(stream, state) { - var style = state.text(stream, state) + var style = state.text(stream, state); if (typeof style !== 'undefined') return style; + if (state.list) { // List marker (*, +, -, 1., etc) + state.list = null; + return list; + } + var ch = stream.next(); if (ch === '\\') { stream.next(); return getType(state); } + + // Matches link titles present on next line + if (state.linkTitle) { + state.linkTitle = false; + var matchCh = ch; + if (ch === '(') { + matchCh = ')'; + } + matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); + var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh; + if (stream.match(new RegExp(regex), true)) { + return linkhref; + } + } + + // If this block is changed, it may need to be updated in GFM mode if (ch === '`') { - return switchInline(stream, state, inlineElement(code, '`')); + var t = getType(state); + var before = stream.pos; + stream.eatWhile('`'); + var difference = 1 + stream.pos - before; + if (!state.code) { + codeDepth = difference; + state.code = true; + return getType(state); + } else { + if (difference === codeDepth) { // Must be exact + state.code = false; + return t; + } + return getType(state); + } + } else if (state.code) { + return getType(state); + } + + if (ch === '!' && stream.match(/\[.*\] ?(?:\(|\[)/, false)) { + stream.match(/\[.*\]/); + state.inline = state.f = linkHref; + return image; + } + + if (ch === '[' && stream.match(/.*\](\(| ?\[)/, false)) { + state.linkText = true; + return getType(state); } - if (ch === '[') { - return switchInline(stream, state, linkText); + + if (ch === ']' && state.linkText) { + var type = getType(state); + state.linkText = false; + state.inline = state.f = linkHref; + return type; + } + + if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, true)) { + return switchInline(stream, state, inlineElement(linkinline, '>')); } + + if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, true)) { + return switchInline(stream, state, inlineElement(linkemail, '>')); + } + if (ch === '<' && stream.match(/^\w/, false)) { var md_inside = false; if (stream.string.indexOf(">")!=-1) { @@ -139,31 +295,51 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { return "tag"; } + var ignoreUnderscore = false; + if (!modeCfg.underscoresBreakWords) { + if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) { + var prevPos = stream.pos - 2; + if (prevPos >= 0) { + var prevCh = stream.string.charAt(prevPos); + if (prevCh !== '_' && prevCh.match(/(\w)/, false)) { + ignoreUnderscore = true; + } + } + } + } var t = getType(state); - if (ch === '*' || ch === '_') { - if (stream.eat(ch)) { - return (state.strong = !state.strong) ? getType(state) : t; + if (ch === '*' || (ch === '_' && !ignoreUnderscore)) { + if (state.strong === ch && stream.eat(ch)) { // Remove STRONG + state.strong = false; + return t; + } else if (!state.strong && stream.eat(ch)) { // Add STRONG + state.strong = ch; + return getType(state); + } else if (state.em === ch) { // Remove EM + state.em = false; + return t; + } else if (!state.em) { // Add EM + state.em = ch; + return getType(state); + } + } else if (ch === ' ') { + if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces + if (stream.peek() === ' ') { // Surrounded by spaces, ignore + return getType(state); + } else { // Not surrounded by spaces, back up pointer + stream.backUp(1); + } } - return (state.em = !state.em) ? getType(state) : t; } return getType(state); } - function linkText(stream, state) { - while (!stream.eol()) { - var ch = stream.next(); - if (ch === '\\') stream.next(); - if (ch === ']') { - state.inline = state.f = linkHref; - return linktext; - } - } - return linktext; - } - function linkHref(stream, state) { - stream.eatSpace(); + // Check if space, and return NULL if so (to avoid marking the space) + if(stream.eatSpace()){ + return null; + } var ch = stream.next(); if (ch === '(' || ch === '[') { return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']')); @@ -180,19 +356,32 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { } function footnoteUrl(stream, state) { - stream.eatSpace(); + // Check if space, and return NULL if so (to avoid marking the space) + if(stream.eatSpace()){ + return null; + } + // Match URL stream.match(/^[^\s]+/, true); + // Check for link title + if (stream.peek() === undefined) { // End of line, set flag to check next line + state.linkTitle = true; + } else { // More content on line, check if link title + stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true); + } state.f = state.inline = inlineNormal; return linkhref; } + var savedInlineRE = []; function inlineRE(endChar) { - if (!inlineRE[endChar]) { - // match any not-escaped-non-endChar and any escaped char - // then match endChar or eol - inlineRE[endChar] = new RegExp('^(?:[^\\\\\\' + endChar + ']|\\\\.)*(?:\\' + endChar + '|$)'); + if (!savedInlineRE[endChar]) { + // Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741) + endChar = (endChar+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); + // Match any non-endChar, escaped character, as well as the closing + // endChar. + savedInlineRE[endChar] = new RegExp('^(?:[^\\\\]|\\\\.)*?(' + endChar + ')'); } - return inlineRE[endChar]; + return savedInlineRE[endChar]; } function inlineElement(type, endChar, next) { @@ -206,6 +395,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { return { startState: function() { + prevLineHasContent = false; + thisLineHasContent = false; return { f: blockNormal, @@ -215,9 +406,13 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { inline: inlineNormal, text: handleText, + + linkText: false, + linkTitle: false, em: false, strong: false, header: false, + list: false, quote: false }; }, @@ -229,12 +424,17 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { block: s.block, htmlState: CodeMirror.copyState(htmlMode, s.htmlState), indentation: s.indentation, + + localMode: s.localMode, + localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null, inline: s.inline, text: s.text, + linkTitle: s.linkTitle, em: s.em, strong: s.strong, header: s.header, + list: s.list, quote: s.quote, md_inside: s.md_inside }; @@ -242,15 +442,28 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { token: function(stream, state) { if (stream.sol()) { - if (stream.match(/^\s*$/, true)) { return blankLine(state); } + if (stream.match(/^\s*$/, true)) { + prevLineHasContent = false; + return blankLine(state); + } else { + if(thisLineHasContent){ + prevLineHasContent = true; + thisLineHasContent = false; + } + thisLineHasContent = true; + } // Reset state.header state.header = false; - // Reset state.quote - state.quote = false; + + // Reset state.code + state.code = false; state.f = state.block; var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length; + var difference = Math.floor((indentation - state.indentation) / 4) * 4; + if (difference > 4) difference = 4; + indentation = state.indentation + difference; state.indentationDiff = indentation - state.indentation; state.indentation = indentation; if (indentation > 0) { return null; } diff --git a/app/assets/mode/ntriples/ntriples.js b/app/assets/mode/ntriples/ntriples.js index 3b6cb4167..abe6a1a0d 100644 --- a/app/assets/mode/ntriples/ntriples.js +++ b/app/assets/mode/ntriples/ntriples.js @@ -27,7 +27,7 @@ */ CodeMirror.defineMode("ntriples", function() { - Location = { + var Location = { PRE_SUBJECT : 0, WRITING_SUB_URI : 1, WRITING_BNODE_URI : 2, @@ -87,8 +87,8 @@ CodeMirror.defineMode("ntriples", function() { currState.location=ret; } - untilSpace = function(c) { return c != ' '; }; - untilEndURI = function(c) { return c != '>'; }; + var untilSpace = function(c) { return c != ' '; }; + var untilEndURI = function(c) { return c != '>'; }; return { startState: function() { return { @@ -114,7 +114,7 @@ CodeMirror.defineMode("ntriples", function() { } if(ch == '#') { var parsedAnchor = ''; - stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false}); + stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false;}); state.anchors.push(parsedAnchor); return 'variable-2'; } diff --git a/app/assets/mode/ocaml/ocaml.js b/app/assets/mode/ocaml/ocaml.js index 294d9446a..81edfd88a 100644 --- a/app/assets/mode/ocaml/ocaml.js +++ b/app/assets/mode/ocaml/ocaml.js @@ -103,7 +103,7 @@ CodeMirror.defineMode('ocaml', function(config) { } return { - startState: function() {return {tokenize: tokenBase, commentLevel: 0}}, + startState: function() {return {tokenize: tokenBase, commentLevel: 0};}, token: function(stream, state) { if (stream.eatSpace()) return null; return state.tokenize(stream, state); diff --git a/app/assets/mode/pascal/pascal.js b/app/assets/mode/pascal/pascal.js index 55d1fb65d..b11d2d0a0 100644 --- a/app/assets/mode/pascal/pascal.js +++ b/app/assets/mode/pascal/pascal.js @@ -26,7 +26,7 @@ CodeMirror.defineMode("pascal", function(config) { return tokenComment(stream, state); } if (/[\[\]{}\(\),;\:\.]/.test(ch)) { - return null + return null; } if (/\d/.test(ch)) { stream.eatWhile(/[\w\.]/); diff --git a/app/assets/mode/perl/perl.js b/app/assets/mode/perl/perl.js index 7fa129eac..a6446294f 100644 --- a/app/assets/mode/perl/perl.js +++ b/app/assets/mode/perl/perl.js @@ -477,22 +477,22 @@ CodeMirror.defineMode("perl",function(config,parserConfig){ if(chain[++i]!==undefined){ state.chain=chain[i]; state.style=style; - state.tail=tail} + state.tail=tail;} else if(tail) stream.eatWhile(tail); state.tokenize=tokenPerl; - return style} - e=!e&&c=="\\"} - return style}; - return state.tokenize(stream,state)} + return style;} + e=!e&&c=="\\";} + return style;}; + return state.tokenize(stream,state);} function tokenSOMETHING(stream,state,string){ state.tokenize=function(stream,state){ if(stream.string==string) state.tokenize=tokenPerl; stream.skipToEnd(); - return "string"}; - return state.tokenize(stream,state)} + return "string";}; + return state.tokenize(stream,state);} function tokenPerl(stream,state){ if(stream.eatSpace()) @@ -504,9 +504,9 @@ CodeMirror.defineMode("perl",function(config,parserConfig){ return 'number'; if(stream.match(/^<<(?=\w)/)){ // NOTE: <"],RXstyle,RXmodifiers)} + return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);} if(/[\^'"!~\/]/.test(c)){ stream.eatSuffix(1); - return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers)}} + return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}} else if(c=="q"){ c=stream.look(1); if(c=="("){ stream.eatSuffix(2); - return tokenChain(stream,state,[")"],"string")} + return tokenChain(stream,state,[")"],"string");} if(c=="["){ stream.eatSuffix(2); - return tokenChain(stream,state,["]"],"string")} + return tokenChain(stream,state,["]"],"string");} if(c=="{"){ stream.eatSuffix(2); - return tokenChain(stream,state,["}"],"string")} + return tokenChain(stream,state,["}"],"string");} if(c=="<"){ stream.eatSuffix(2); - return tokenChain(stream,state,[">"],"string")} + return tokenChain(stream,state,[">"],"string");} if(/[\^'"!~\/]/.test(c)){ stream.eatSuffix(1); - return tokenChain(stream,state,[stream.eat(c)],"string")}} + return tokenChain(stream,state,[stream.eat(c)],"string");}} else if(c=="w"){ c=stream.look(1); if(c=="("){ stream.eatSuffix(2); - return tokenChain(stream,state,[")"],"bracket")} + return tokenChain(stream,state,[")"],"bracket");} if(c=="["){ stream.eatSuffix(2); - return tokenChain(stream,state,["]"],"bracket")} + return tokenChain(stream,state,["]"],"bracket");} if(c=="{"){ stream.eatSuffix(2); - return tokenChain(stream,state,["}"],"bracket")} + return tokenChain(stream,state,["}"],"bracket");} if(c=="<"){ stream.eatSuffix(2); - return tokenChain(stream,state,[">"],"bracket")} + return tokenChain(stream,state,[">"],"bracket");} if(/[\^'"!~\/]/.test(c)){ stream.eatSuffix(1); - return tokenChain(stream,state,[stream.eat(c)],"bracket")}} + return tokenChain(stream,state,[stream.eat(c)],"bracket");}} else if(c=="r"){ c=stream.look(1); if(c=="("){ stream.eatSuffix(2); - return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)} + return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);} if(c=="["){ stream.eatSuffix(2); - return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)} + return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);} if(c=="{"){ stream.eatSuffix(2); - return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)} + return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);} if(c=="<"){ stream.eatSuffix(2); - return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)} + return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);} if(/[\^'"!~\/]/.test(c)){ stream.eatSuffix(1); - return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers)}} + return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}} else if(/[\^'"!~\/(\[{<]/.test(c)){ if(c=="("){ stream.eatSuffix(1); - return tokenChain(stream,state,[")"],"string")} + return tokenChain(stream,state,[")"],"string");} if(c=="["){ stream.eatSuffix(1); - return tokenChain(stream,state,["]"],"string")} + return tokenChain(stream,state,["]"],"string");} if(c=="{"){ stream.eatSuffix(1); - return tokenChain(stream,state,["}"],"string")} + return tokenChain(stream,state,["}"],"string");} if(c=="<"){ stream.eatSuffix(1); - return tokenChain(stream,state,[">"],"string")} + return tokenChain(stream,state,[">"],"string");} if(/[\^'"!~\/]/.test(c)){ - return tokenChain(stream,state,[stream.eat(c)],"string")}}}} + return tokenChain(stream,state,[stream.eat(c)],"string");}}}} if(ch=="m"){ var c=stream.look(-2); if(!(c&&/\w/.test(c))){ c=stream.eat(/[(\[{<\^'"!~\/]/); if(c){ if(/[\^'"!~\/]/.test(c)){ - return tokenChain(stream,state,[c],RXstyle,RXmodifiers)} + return tokenChain(stream,state,[c],RXstyle,RXmodifiers);} if(c=="("){ - return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)} + return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);} if(c=="["){ - return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)} + return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);} if(c=="{"){ - return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)} + return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);} if(c=="<"){ - return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)}}}} + return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}}}} if(ch=="s"){ var c=/[\/>\]})\w]/.test(stream.look(-2)); if(!c){ @@ -632,7 +632,7 @@ CodeMirror.defineMode("perl",function(config,parserConfig){ return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); if(c=="(") return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); - return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}} + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}} if(ch=="y"){ var c=/[\/>\]})\w]/.test(stream.look(-2)); if(!c){ @@ -646,7 +646,7 @@ CodeMirror.defineMode("perl",function(config,parserConfig){ return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); if(c=="(") return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); - return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}} + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}} if(ch=="t"){ var c=/[\/>\]})\w]/.test(stream.look(-2)); if(!c){ @@ -661,65 +661,65 @@ CodeMirror.defineMode("perl",function(config,parserConfig){ return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); if(c=="(") return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); - return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}}} + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}} if(ch=="`"){ - return tokenChain(stream,state,[ch],"variable-2")} + return tokenChain(stream,state,[ch],"variable-2");} if(ch=="/"){ if(!/~\s*$/.test(stream.prefix())) return "operator"; else - return tokenChain(stream,state,[ch],RXstyle,RXmodifiers)} + return tokenChain(stream,state,[ch],RXstyle,RXmodifiers);} if(ch=="$"){ var p=stream.pos; if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}")) return "variable-2"; else - stream.pos=p} + stream.pos=p;} if(/[$@%]/.test(ch)){ var p=stream.pos; if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(stream.look(-2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){ var c=stream.current(); if(PERL[c]) - return "variable-2"} - stream.pos=p} + return "variable-2";} + stream.pos=p;} if(/[$@%&]/.test(ch)){ if(stream.eatWhile(/[\w$\[\]]/)||stream.eat("{")&&stream.eatWhile(/[\w$\[\]]/)&&stream.eat("}")){ var c=stream.current(); if(PERL[c]) return "variable-2"; else - return "variable"}} + return "variable";}} if(ch=="#"){ if(stream.look(-2)!="$"){ stream.skipToEnd(); - return "comment"}} + return "comment";}} if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){ var p=stream.pos; stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/); if(PERL[stream.current()]) return "operator"; else - stream.pos=p} + stream.pos=p;} if(ch=="_"){ if(stream.pos==1){ if(stream.suffix(6)=="_END__"){ - return tokenChain(stream,state,['\0'],"comment")} + return tokenChain(stream,state,['\0'],"comment");} else if(stream.suffix(7)=="_DATA__"){ - return tokenChain(stream,state,['\0'],"variable-2")} + return tokenChain(stream,state,['\0'],"variable-2");} else if(stream.suffix(7)=="_C__"){ - return tokenChain(stream,state,['\0'],"string")}}} + return tokenChain(stream,state,['\0'],"string");}}} if(/\w/.test(ch)){ var p=stream.pos; if(stream.look(-2)=="{"&&(stream.look(0)=="}"||stream.eatWhile(/\w/)&&stream.look(0)=="}")) return "string"; else - stream.pos=p} + stream.pos=p;} if(/[A-Z]/.test(ch)){ var l=stream.look(-2); var p=stream.pos; stream.eatWhile(/[A-Z_]/); if(/[\da-z]/.test(stream.look(0))){ - stream.pos=p} + stream.pos=p;} else{ var c=PERL[stream.current()]; if(!c) @@ -738,9 +738,9 @@ CodeMirror.defineMode("perl",function(config,parserConfig){ else if(c==5) return "variable-2"; else - return "meta"} + return "meta";} else - return "meta"}} + return "meta";}} if(/[a-zA-Z_]/.test(ch)){ var l=stream.look(-2); stream.eatWhile(/\w/); @@ -761,10 +761,10 @@ CodeMirror.defineMode("perl",function(config,parserConfig){ else if(c==5) return "variable-2"; else - return "meta"} + return "meta";} else - return "meta"} - return null} + return "meta";} + return null;} return{ startState:function(){ @@ -772,37 +772,37 @@ CodeMirror.defineMode("perl",function(config,parserConfig){ tokenize:tokenPerl, chain:null, style:null, - tail:null}}, + tail:null};}, token:function(stream,state){ - return (state.tokenize||tokenPerl)(stream,state)}, - electricChars:"{}"}}); + return (state.tokenize||tokenPerl)(stream,state);}, + electricChars:"{}"};}); CodeMirror.defineMIME("text/x-perl", "perl"); // it's like "peek", but need for look-ahead or look-behind if index < 0 CodeMirror.StringStream.prototype.look=function(c){ - return this.string.charAt(this.pos+(c||0))}; + return this.string.charAt(this.pos+(c||0));}; // return a part of prefix of current stream from current position CodeMirror.StringStream.prototype.prefix=function(c){ if(c){ var x=this.pos-c; - return this.string.substr((x>=0?x:0),c)} + return this.string.substr((x>=0?x:0),c);} else{ - return this.string.substr(0,this.pos-1)}}; + return this.string.substr(0,this.pos-1);}}; // return a part of suffix of current stream from current position CodeMirror.StringStream.prototype.suffix=function(c){ var y=this.string.length; var x=y-this.pos+1; - return this.string.substr(this.pos,(c&&c=(y=this.string.length-1)) this.pos=y; else - this.pos=x}; + this.pos=x;}; diff --git a/app/assets/mode/php/php.js b/app/assets/mode/php/php.js index e35922fd9..b94317c74 100644 --- a/app/assets/mode/php/php.js +++ b/app/assets/mode/php/php.js @@ -9,7 +9,7 @@ if (stream.match(delim)) state.tokenize = null; else stream.skipToEnd(); return "string"; - } + }; } var phpConfig = { name: "clike", @@ -56,14 +56,13 @@ var phpMode = CodeMirror.getMode(config, phpConfig); function dispatch(stream, state) { // TODO open PHP inside text/css - var isPHP = state.mode == "php"; + var isPHP = state.curMode == phpMode; if (stream.sol() && state.pending != '"') state.pending = null; if (state.curMode == htmlMode) { if (stream.match(/^<\?\w*/)) { state.curMode = phpMode; state.curState = state.php; state.curClose = "?>"; - state.mode = "php"; return "meta"; } if (state.pending == '"') { @@ -86,13 +85,11 @@ state.curMode = jsMode; state.curState = jsMode.startState(htmlMode.indent(state.curState, "")); state.curClose = /^<\/\s*script\s*>/i; - state.mode = "javascript"; } else if (/^style$/i.test(state.curState.context.tagName)) { state.curMode = cssMode; state.curState = cssMode.startState(htmlMode.indent(state.curState, "")); state.curClose = /^<\/\s*style\s*>/i; - state.mode = "css"; } } return style; @@ -101,7 +98,6 @@ state.curMode = htmlMode; state.curState = state.html; state.curClose = null; - state.mode = "html"; if (isPHP) return "meta"; else return dispatch(stream, state); } else { @@ -118,7 +114,7 @@ curState: parserConfig.startOpen ? phpMode.startState() : html, curClose: parserConfig.startOpen ? /^\?>/ : null, mode: parserConfig.startOpen ? "php" : "html", - pending: null} + pending: null}; }, copyState: function(state) { @@ -141,8 +137,10 @@ return state.curMode.indent(state.curState, textAfter); }, - electricChars: "/{}:" - } + electricChars: "/{}:", + + innerMode: function(state) { return {state: state.curState, mode: state.curMode}; } + }; }, "xml", "clike", "javascript", "css"); CodeMirror.defineMIME("application/x-httpd-php", "php"); CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true}); diff --git a/app/assets/mode/pig/pig.js b/app/assets/mode/pig/pig.js index e893e5715..d55413f14 100644 --- a/app/assets/mode/pig/pig.js +++ b/app/assets/mode/pig/pig.js @@ -107,11 +107,11 @@ CodeMirror.defineMode("pig", function(config, parserConfig) { // is it one of the builtin functions? if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) { - return ("keyword", "variable-2") + return ("keyword", "variable-2"); } // is it one of the listed types? if (types && types.propertyIsEnumerable(stream.current().toUpperCase())) - return ("keyword", "variable-3") + return ("keyword", "variable-3"); // default is a 'variable' return ret("variable", "pig-word"); } @@ -161,7 +161,7 @@ CodeMirror.defineMode("pig", function(config, parserConfig) { + "NEQ MATCHES TRUE FALSE "; // data types - var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP " + var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP "; CodeMirror.defineMIME("text/x-pig", { name: "pig", diff --git a/app/assets/mode/properties/properties.js b/app/assets/mode/properties/properties.js old mode 100755 new mode 100644 diff --git a/app/assets/mode/python/python.js b/app/assets/mode/python/python.js index d6888e8e5..fc5b9551c 100644 --- a/app/assets/mode/python/python.js +++ b/app/assets/mode/python/python.js @@ -227,7 +227,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) { while (state.scopes[0].offset !== _indent) { state.scopes.shift(); } - return false + return false; } else { if (type === 'py') { state.scopes[0].offset = stream.indentation(); diff --git a/app/assets/mode/scheme/scheme.js b/app/assets/mode/scheme/scheme.js index f981b235b..2411db079 100644 --- a/app/assets/mode/scheme/scheme.js +++ b/app/assets/mode/scheme/scheme.js @@ -166,7 +166,7 @@ CodeMirror.defineMode("scheme", function (config, mode) { stream.skipToEnd(); // rest of the line is a comment returnType = COMMENT; } else if (ch == "(" || ch == "[") { - var keyWord = ''; var indentTemp = stream.column(); + var keyWord = ''; var indentTemp = stream.column(), letter; /** Either (indent-word .. diff --git a/app/assets/mode/shell/shell.js b/app/assets/mode/shell/shell.js index df771312c..d4eba852b 100644 --- a/app/assets/mode/shell/shell.js +++ b/app/assets/mode/shell/shell.js @@ -60,7 +60,7 @@ CodeMirror.defineMode('shell', function(config) { stream.eatWhile(/\w/); var cur = stream.current(); if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; - return words[cur] || null; + return words.hasOwnProperty(cur) ? words[cur] : null; } function tokenString(quote) { @@ -107,7 +107,7 @@ CodeMirror.defineMode('shell', function(config) { }; return { - startState: function() {return {tokens:[]}}, + startState: function() {return {tokens:[]};}, token: function(stream, state) { if (stream.eatSpace()) return null; return tokenize(stream, state); diff --git a/app/assets/mode/sieve/LICENSE b/app/assets/mode/sieve/LICENSE new file mode 100644 index 000000000..24e4c94c0 --- /dev/null +++ b/app/assets/mode/sieve/LICENSE @@ -0,0 +1,23 @@ +Copyright (C) 2012 Thomas Schmid + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +Please note that some subdirectories of the CodeMirror distribution +include their own LICENSE files, and are released under different +licences. diff --git a/app/assets/mode/sieve/sieve.js b/app/assets/mode/sieve/sieve.js new file mode 100644 index 000000000..db777c131 --- /dev/null +++ b/app/assets/mode/sieve/sieve.js @@ -0,0 +1,156 @@ +/* + * See LICENSE in this directory for the license under which this code + * is released. + */ + +CodeMirror.defineMode("sieve", function(config) { + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = words("if elsif else stop require"); + var atoms = words("true false not"); + var indentUnit = config.indentUnit; + + function tokenBase(stream, state) { + + var ch = stream.next(); + if (ch == "/" && stream.eat("*")) { + state.tokenize = tokenCComment; + return tokenCComment(stream, state); + } + + if (ch === '#') { + stream.skipToEnd(); + return "comment"; + } + + if (ch == "\"") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + + if (ch === "{") + { + state._indent++; + return null; + } + + if (ch === "}") + { + state._indent--; + return null; + } + + if (/[{}\(\),;]/.test(ch)) + return null; + + // 1*DIGIT "K" / "M" / "G" + if (/\d/.test(ch)) { + stream.eatWhile(/[\d]/); + stream.eat(/[KkMmGg]/); + return "number"; + } + + // ":" (ALPHA / "_") *(ALPHA / DIGIT / "_") + if (ch == ":") { + stream.eatWhile(/[a-zA-Z_]/); + stream.eatWhile(/[a-zA-Z0-9_]/); + + return "operator"; + } + + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + + // "text:" *(SP / HTAB) (hash-comment / CRLF) + // *(multiline-literal / multiline-dotstart) + // "." CRLF + if ((cur == "text") && stream.eat(":")) + { + state.tokenize = tokenMultiLineString; + return "string"; + } + + if (keywords.propertyIsEnumerable(cur)) + return "keyword"; + + if (atoms.propertyIsEnumerable(cur)) + return "atom"; + } + + function tokenMultiLineString(stream, state) + { + state._multiLineString = true; + // the first line is special it may contain a comment + if (!stream.sol()) { + stream.eatSpace(); + + if (stream.peek() == "#") { + stream.skipToEnd(); + return "comment"; + } + + stream.skipToEnd(); + return "string"; + } + + if ((stream.next() == ".") && (stream.eol())) + { + state._multiLineString = false; + state.tokenize = tokenBase; + } + + return "string"; + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return "string"; + }; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + baseIndent: base || 0, + _indent: 0}; + }, + + token: function(stream, state) { + if (stream.eatSpace()) + return null; + + return (state.tokenize || tokenBase)(stream, state);; + }, + + indent: function(state, textAfter) { + return state.baseIndent + state._indent * indentUnit; + }, + + electricChars: "}" + }; +}); + +CodeMirror.defineMIME("application/sieve", "sieve"); diff --git a/app/assets/mode/smalltalk/smalltalk.js b/app/assets/mode/smalltalk/smalltalk.js index e58933223..ba17cbdc9 100644 --- a/app/assets/mode/smalltalk/smalltalk.js +++ b/app/assets/mode/smalltalk/smalltalk.js @@ -63,7 +63,7 @@ CodeMirror.defineMode('smalltalk', function(config, modeConfig) { } else if (/\d/.test(aChar)) { stream.eatWhile(/[\w\d]/); - token.name = 'number' + token.name = 'number'; } else if (/[\w_]/.test(aChar)) { stream.eatWhile(/[\w\d_]/); @@ -100,7 +100,7 @@ CodeMirror.defineMode('smalltalk', function(config, modeConfig) { } return token; - } + }; return { startState: function() { diff --git a/app/assets/mode/smarty/smarty.js b/app/assets/mode/smarty/smarty.js index 9da7da626..941e7f374 100644 --- a/app/assets/mode/smarty/smarty.js +++ b/app/assets/mode/smarty/smarty.js @@ -5,7 +5,7 @@ CodeMirror.defineMode("smarty", function(config, parserConfig) { operatorChars: /[+\-*&%=<>!?]/, validIdentifier: /[a-zA-Z0-9\_]/, stringChar: /[\'\"]/ - } + }; var leftDelim = (typeof config.mode.leftDelimiter != 'undefined') ? config.mode.leftDelimiter : "{"; var rightDelim = (typeof config.mode.rightDelimiter != 'undefined') ? config.mode.rightDelimiter : "}"; function ret(style, lst) { last = lst; return style; } @@ -142,7 +142,7 @@ CodeMirror.defineMode("smarty", function(config, parserConfig) { return style; }, electricChars: "" - } + }; }); CodeMirror.defineMIME("text/x-smarty", "smarty"); \ No newline at end of file diff --git a/app/assets/mode/stex/stex.js b/app/assets/mode/stex/stex.js index 2e2f026a5..100854dab 100644 --- a/app/assets/mode/stex/stex.js +++ b/app/assets/mode/stex/stex.js @@ -54,7 +54,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg) }; this.closeBracket = function(content) { }; - } + }; } var plugins = new Array(); diff --git a/app/assets/mode/tiki/tiki.js b/app/assets/mode/tiki/tiki.js index 350dd51bf..af83dc1b5 100644 --- a/app/assets/mode/tiki/tiki.js +++ b/app/assets/mode/tiki/tiki.js @@ -18,7 +18,7 @@ CodeMirror.defineMode('tiki', function(config, parserConfig) { function inLine(style, terminator) { return function(stream, state) { while(!stream.eol()) { - stream.next() + stream.next(); } state.tokenize = inText; return style; @@ -37,9 +37,9 @@ CodeMirror.defineMode('tiki', function(config, parserConfig) { //non start of line switch (ch) { //switch is generally much faster than if, so it is used here case "{": //plugin - type = stream.eat("/") ? "closeTag" : "openTag"; + var type = stream.eat("/") ? "closeTag" : "openTag"; stream.eatSpace(); - tagName = ""; + var tagName = ""; var c; while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c; state.tokenize = inPlugin; @@ -251,7 +251,7 @@ CodeMirror.defineMode('tiki', function(config, parserConfig) { if (err) setStyle = "error"; if (type == "endPlugin") return cont(); return pass(); - } + }; } function attributes(type) { @@ -301,13 +301,6 @@ CodeMirror.defineMode('tiki', function(config, parserConfig) { if (context) return context.indent + indentUnit; else return 0; }, - compareStates: function(a, b) { - if (a.indented != b.indented || a.pluginName != b.pluginName) return false; - for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) { - if (!ca || !cb) return ca == cb; - if (ca.pluginName != cb.pluginName) return false; - } - }, electricChars: "/" }; }); diff --git a/app/assets/mode/vb/vb.js b/app/assets/mode/vb/vb.js index 01f989038..be01d13ad 100644 --- a/app/assets/mode/vb/vb.js +++ b/app/assets/mode/vb/vb.js @@ -12,8 +12,8 @@ CodeMirror.defineMode("vb", function(conf, parserConf) { var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); - var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property']; - var middleKeywords = ['else','elseif','case']; + var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try']; + var middleKeywords = ['else','elseif','case', 'catch']; var endKeywords = ['next','loop']; var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'in']); diff --git a/app/assets/mode/velocity/velocity.js b/app/assets/mode/velocity/velocity.js index 0b80c7581..b7048b152 100644 --- a/app/assets/mode/velocity/velocity.js +++ b/app/assets/mode/velocity/velocity.js @@ -5,7 +5,7 @@ CodeMirror.defineMode("velocity", function(config) { return obj; } - var indentUnit = config.indentUnit + var indentUnit = config.indentUnit; var keywords = parseWords("#end #else #break #stop #[[ #]] " + "#{end} #{else} #{break} #{stop}"); var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " + diff --git a/app/assets/mode/verilog/verilog.js b/app/assets/mode/verilog/verilog.js index 62700ceaf..3e3eca9b9 100644 --- a/app/assets/mode/verilog/verilog.js +++ b/app/assets/mode/verilog/verilog.js @@ -21,7 +21,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { } if (/[\[\]{}\(\),;\:\.]/.test(ch)) { curPunc = ch; - return null + return null; } if (/[\d']/.test(ch)) { stream.eatWhile(/[\w\.']/); diff --git a/app/assets/mode/xml/xml.js b/app/assets/mode/xml/xml.js index 060dad181..860e368f5 100644 --- a/app/assets/mode/xml/xml.js +++ b/app/assets/mode/xml/xml.js @@ -30,7 +30,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) { }, doNotIndent: {"pre": true}, allowUnquoted: true, - allowMissing: false + allowMissing: true } : { autoSelfClosers: {}, implicitlyClosed: {}, @@ -229,7 +229,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) { if (type == "endTag") { popContext(); return cont(); } setStyle = "error"; return cont(arguments.callee); - } + }; } function maybePopContext(nextTagName) { var parentTagName; @@ -308,14 +308,6 @@ CodeMirror.defineMode("xml", function(config, parserConfig) { else return 0; }, - compareStates: function(a, b) { - if (a.indented != b.indented || a.tokenize != b.tokenize) return false; - for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) { - if (!ca || !cb) return ca == cb; - if (ca.tagName != cb.tagName || ca.indent != cb.indent) return false; - } - }, - electricChars: "/" }; }); diff --git a/app/assets/mode/xquery/test/testBase.js b/app/assets/mode/xquery/test/testBase.js deleted file mode 100644 index d40e9eeab..000000000 --- a/app/assets/mode/xquery/test/testBase.js +++ /dev/null @@ -1,42 +0,0 @@ - $(document).ready(function(){ - module("testBase"); - test("eviltest", function() { - expect(1); - - var input = 'xquery version "1.0-ml";\ - (: this is\ - : a \ - "comment" :)\ - let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x>\ - let $joe:=1\ - return element element {\ - attribute attribute { 1 },\ - element test { 'a' }, \ - attribute foo { "bar" },\ - fn:doc()[ foo/@bar eq $let ],\ - //x } \ - \ - (: a more \'evil\' test :)\ - (: Modified Blakeley example (: with nested comment :) ... :)\ - declare private function local:declare() {()};\ - declare private function local:private() {()};\ - declare private function local:function() {()};\ - declare private function local:local() {()};\ - let $let := <let>let $let := "let"</let>\ - return element element {\ - attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },\ - attribute fn:doc { "bar" castable as xs:string },\ - element text { text { "text" } },\ - fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],\ - //fn:doc\ - }'; - var expected = 'xquery version "1.0-ml"; (: this is : a "comment" :) let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x> let $joe:=1 return element element { attribute attribute { 1 }, element test { \'a\' }, attribute foo { "bar" }, fn:doc()[ foo/@bar eq $let ], //x } (: a more \'evil\' test :) (: Modified Blakeley example (: with nested comment :) ... :) declare private function local:declare() {()}; declare private function local:private() {()}; declare private function local:function() {()}; declare private function local:local() {()}; let $let := <let>let $let := "let"</let> return element element { attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } }, attribute fn:doc { "bar" castable as xs:string }, element text { text { "text" } }, fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ], //fn:doc }'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - }); diff --git a/app/assets/mode/xquery/test/testEmptySequenceKeyword.js b/app/assets/mode/xquery/test/testEmptySequenceKeyword.js deleted file mode 100644 index 39ed09050..000000000 --- a/app/assets/mode/xquery/test/testEmptySequenceKeyword.js +++ /dev/null @@ -1,16 +0,0 @@ -$(document).ready(function(){ - module("testEmptySequenceKeyword"); - test("testEmptySequenceKeyword", function() { - expect(1); - - var input = '"foo" instance of empty-sequence()'; - var expected = '"foo" instance of empty-sequence()'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); -}); diff --git a/app/assets/mode/xquery/test/testMultiAttr.js b/app/assets/mode/xquery/test/testMultiAttr.js deleted file mode 100644 index 8e98c47d6..000000000 --- a/app/assets/mode/xquery/test/testMultiAttr.js +++ /dev/null @@ -1,16 +0,0 @@ - $(document).ready(function(){ - module("testMultiAttr"); - test("test1", function() { - expect(1); - - var expected = '<p a1="foo" a2="bar">hello world</p>'; - - $("#sandbox").html(''); - $("#editor").html('

hello world

'); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - }); \ No newline at end of file diff --git a/app/assets/mode/xquery/test/testNamespaces.js b/app/assets/mode/xquery/test/testNamespaces.js deleted file mode 100644 index 4efea63e0..000000000 --- a/app/assets/mode/xquery/test/testNamespaces.js +++ /dev/null @@ -1,91 +0,0 @@ -$(document).ready(function(){ - module("test namespaces"); - -// -------------------------------------------------------------------------------- -// this test is based on this: -//http://mbrevoort.github.com/CodeMirror2/#!exprSeqTypes/PrologExpr/VariableProlog/ExternalVariablesWith/K2-ExternalVariablesWith-10.xq -// -------------------------------------------------------------------------------- - test("test namespaced variable", function() { - expect(1); - - var input = 'declare namespace e = "http://example.com/ANamespace";\ -declare variable $e:exampleComThisVarIsNotRecognized as element(*) external;'; - - var expected = 'declare namespace e = "http://example.com/ANamespace";declare variable $e:exampleComThisVarIsNotRecognized as element(*) external;'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - - -// -------------------------------------------------------------------------------- -// this test is based on: -// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-002.xq -// -------------------------------------------------------------------------------- - test("test EQName variable", function() { - expect(1); - - var input = 'declare variable $"http://www.example.com/ns/my":var := 12;\ -{$"http://www.example.com/ns/my":var}'; - - var expected = 'declare variable $"http://www.example.com/ns/my":var := 12;<out>{$"http://www.example.com/ns/my":var}</out>'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - -// -------------------------------------------------------------------------------- -// this test is based on: -// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq -// -------------------------------------------------------------------------------- - test("test EQName function", function() { - expect(1); - - var input = 'declare function "http://www.example.com/ns/my":fn ($a as xs:integer) as xs:integer {\ - $a + 2\ -};\ -{"http://www.example.com/ns/my":fn(12)}'; - - var expected = 'declare function "http://www.example.com/ns/my":fn ($a as xs:integer) as xs:integer { $a + 2};<out>{"http://www.example.com/ns/my":fn(12)}</out>'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - -// -------------------------------------------------------------------------------- -// this test is based on: -// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq -// -------------------------------------------------------------------------------- - test("test EQName function with single quotes", function() { - expect(1); - - var input = 'declare function \'http://www.example.com/ns/my\':fn ($a as xs:integer) as xs:integer {\ - $a + 2\ -};\ -{\'http://www.example.com/ns/my\':fn(12)}'; - - var expected = 'declare function \'http://www.example.com/ns/my\':fn ($a as xs:integer) as xs:integer { $a + 2};<out>{\'http://www.example.com/ns/my\':fn(12)}</out>'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - -}); - - diff --git a/app/assets/mode/xquery/test/testProcessingInstructions.js b/app/assets/mode/xquery/test/testProcessingInstructions.js deleted file mode 100644 index 9b7530528..000000000 --- a/app/assets/mode/xquery/test/testProcessingInstructions.js +++ /dev/null @@ -1,16 +0,0 @@ -$(document).ready(function(){ - module("testProcessingInstructions"); - test("testProcessingInstructions", function() { - expect(1); - - var input = 'data() instance of xs:string'; - var expected = 'data(<?target content?>) instance of xs:string'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); -}); diff --git a/app/assets/mode/xquery/test/testQuotes.js b/app/assets/mode/xquery/test/testQuotes.js deleted file mode 100644 index 79e5142d9..000000000 --- a/app/assets/mode/xquery/test/testQuotes.js +++ /dev/null @@ -1,19 +0,0 @@ - $(document).ready(function(){ - module("testQuoteEscape"); - test("testQuoteEscapeDouble", function() { - expect(1); - - var input = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"\ -let $keysfolder := concat($rootfolder, "keys\\")\ -return\ -$keysfolder'; - var expected = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"let $keysfolder := concat($rootfolder, "keys\\")return$keysfolder'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - }); diff --git a/app/assets/mode/xquery/xquery.js b/app/assets/mode/xquery/xquery.js index e29c7d8f5..dfb6d7e06 100644 --- a/app/assets/mode/xquery/xquery.js +++ b/app/assets/mode/xquery/xquery.js @@ -56,7 +56,7 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) { 'preceding-sibling','processing-instruction','ref','return','returns','satisfies','schema','schema-element', 'self','some','sortby','stable','text','then','to','treat','typeswitch','union','variable','version','where', 'xquery', 'empty-sequence']; - for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i])}; + for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);}; // a list of types. For each add a property to kwObj with the value of // {type: "atom", style: "atom"} @@ -191,7 +191,7 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) { if(!known) stream.eatWhile(/[\w\$_-]/); // gobble a colon in the case that is a lib func type call fn:doc - var foundColon = stream.eat(":") + var foundColon = stream.eat(":"); // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier // which should get matched as a keyword @@ -325,7 +325,7 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) { state.tokenize = tokenBase; } return ret("tag", "tag"); - } + }; } // tokenizer for XML attributes @@ -365,6 +365,7 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) { // handle comments, including nested function tokenXMLComment(stream, state) { + var ch; while (ch = stream.next()) { if (ch == "-" && stream.match("->", true)) { state.tokenize = tokenBase; @@ -376,6 +377,7 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) { // handle CDATA function tokenCDATA(stream, state) { + var ch; while (ch = stream.next()) { if (ch == "]" && stream.match("]", true)) { state.tokenize = tokenBase; @@ -386,6 +388,7 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) { // handle preprocessing instructions function tokenPreProcessing(stream, state) { + var ch; while (ch = stream.next()) { if (ch == "?" && stream.match(">", true)) { state.tokenize = tokenBase; @@ -422,7 +425,7 @@ CodeMirror.defineMode("xquery", function(config, parserConfig) { function popStateStack(state) { var popped = state.stack.pop(); - var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize + var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize; state.tokenize = reinstateTokenize || tokenBase; } From 991bd2b6326dabf24e02bd5ec1e0fa20788b212e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 09:19:46 -0800 Subject: [PATCH 0049/1055] Add script tag for overlay.js needed by gfm mode --- app/assets/source-editor.html | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/source-editor.html b/app/assets/source-editor.html index d53d1bbf1..258b07a6d 100644 --- a/app/assets/source-editor.html +++ b/app/assets/source-editor.html @@ -5,6 +5,7 @@ + From 0279f1eb7160df73c582b1799e46325fe14ba82a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 09:20:04 -0800 Subject: [PATCH 0050/1055] Add dependency to markdown mode --- app/assets/mode/gfm/gfm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/mode/gfm/gfm.js b/app/assets/mode/gfm/gfm.js index 21b825939..f8a76ee92 100644 --- a/app/assets/mode/gfm/gfm.js +++ b/app/assets/mode/gfm/gfm.js @@ -91,4 +91,4 @@ CodeMirror.defineMode("gfm", function(config, parserConfig) { fencedCodeBlocks: true }); return CodeMirror.overlayMode(CodeMirror.getMode(config, "gfmBase"), gfmOverlay); -}); +}, "markdown"); From b00a4abe64beae243089d4236f97128d207ebdc3 Mon Sep 17 00:00:00 2001 From: Lubomir Vikev Date: Thu, 15 Nov 2012 09:48:42 -0800 Subject: [PATCH 0051/1055] Add missing strings Closes #267 --- app/res/values-bg/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/res/values-bg/strings.xml b/app/res/values-bg/strings.xml index 5c23a4d15..302a6c963 100644 --- a/app/res/values-bg/strings.xml +++ b/app/res/values-bg/strings.xml @@ -240,5 +240,7 @@ любими всички + Сподели + Покажи паролата \ No newline at end of file From c8d819a9b4f62d26872195c8759f234157ebb679 Mon Sep 17 00:00:00 2001 From: "Jose M. Chumo Mata" Date: Thu, 15 Nov 2012 09:57:42 -0800 Subject: [PATCH 0052/1055] Update spanish translation * Add new strings. * Use infinitive instead of imperative for strings indicating actions. * Reorder some strings. This way it's easier to check for unstranslated and unused strings line by line. Closes #269 --- app/res/values-es/strings.xml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/res/values-es/strings.xml b/app/res/values-es/strings.xml index 7ef8fd1af..698a4f13c 100644 --- a/app/res/values-es/strings.xml +++ b/app/res/values-es/strings.xml @@ -42,6 +42,10 @@ Error al seguir Error al dejar de seguir Error al comprobar el estado de seguimiento + Error al marcar como destacado + Error al desmarcar como destacado + Error al comprobar el estado de destacado + Error al renderizar markdown @@ -136,9 +140,7 @@ Gist creado en Android Título Editar - Destacar Destacando Gist… - No Destacar Eliminado Gist de destacados… Cuentas Seleccionar Responsable @@ -180,6 +182,8 @@ Siguiendo Seguir Dejar de seguir + Destacar + No Destacar Miembros Cerrando Incidencia… Reabriendo Incidencia… @@ -227,6 +231,8 @@ Código Siguiendo… Dejando de seguir… + Marcando como destacado… + Desmarcando como destacado… repositorios @@ -247,7 +253,9 @@ favoritas todas - Comparte - Muestra contraseña + Compartir + Mostrar contraseña + Escribir + Vista previa - \ No newline at end of file + From 2a049a9a6c11040c7181988047f393260255718e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 10:02:30 -0800 Subject: [PATCH 0053/1055] Remove unused util scripts --- app/assets/lib/util/multiplex.js | 77 -------------------------------- app/assets/lib/util/runmode.js | 53 ---------------------- 2 files changed, 130 deletions(-) delete mode 100644 app/assets/lib/util/multiplex.js delete mode 100644 app/assets/lib/util/runmode.js diff --git a/app/assets/lib/util/multiplex.js b/app/assets/lib/util/multiplex.js deleted file mode 100644 index 214730839..000000000 --- a/app/assets/lib/util/multiplex.js +++ /dev/null @@ -1,77 +0,0 @@ -CodeMirror.multiplexingMode = function(outer /*, others */) { - // Others should be {open, close, mode [, delimStyle]} objects - var others = Array.prototype.slice.call(arguments, 1); - var n_others = others.length; - - function indexOf(string, pattern, from) { - if (typeof pattern == "string") return string.indexOf(pattern, from); - var m = pattern.exec(from ? string.slice(from) : string); - return m ? m.index + from : -1; - } - - return { - startState: function() { - return { - outer: CodeMirror.startState(outer), - innerActive: null, - inner: null - }; - }, - - copyState: function(state) { - return { - outer: CodeMirror.copyState(outer, state.outer), - innerActive: state.innerActive, - inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner) - }; - }, - - token: function(stream, state) { - if (!state.innerActive) { - var cutOff = Infinity, oldContent = stream.string; - for (var i = 0; i < n_others; ++i) { - var other = others[i]; - var found = indexOf(oldContent, other.open, stream.pos); - if (found == stream.pos) { - stream.match(other.open); - state.innerActive = other; - state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0); - return other.delimStyle; - } else if (found != -1 && found < cutOff) { - cutOff = found; - } - } - if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff); - var outerToken = outer.token(stream, state.outer); - if (cutOff != Infinity) stream.string = oldContent; - return outerToken; - } else { - var curInner = state.innerActive, oldContent = stream.string; - var found = indexOf(oldContent, curInner.close, stream.pos); - if (found == stream.pos) { - stream.match(curInner.close); - state.innerActive = state.inner = null; - return curInner.delimStyle; - } - if (found > -1) stream.string = oldContent.slice(0, found); - var innerToken = curInner.mode.token(stream, state.inner); - if (found > -1) stream.string = oldContent; - var cur = stream.current(), found = cur.indexOf(curInner.close); - if (found > -1) stream.backUp(cur.length - found); - return innerToken; - } - }, - - indent: function(state, textAfter) { - var mode = state.innerActive ? state.innerActive.mode : outer; - if (!mode.indent) return CodeMirror.Pass; - return mode.indent(state.innerActive ? state.inner : state.outer, textAfter); - }, - - electricChars: outer.electricChars, - - innerMode: function(state) { - return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer}; - } - }; -}; diff --git a/app/assets/lib/util/runmode.js b/app/assets/lib/util/runmode.js deleted file mode 100644 index 327976bad..000000000 --- a/app/assets/lib/util/runmode.js +++ /dev/null @@ -1,53 +0,0 @@ -CodeMirror.runMode = function(string, modespec, callback, options) { - function esc(str) { - return str.replace(/[<&]/g, function(ch) { return ch == "<" ? "<" : "&"; }); - } - - var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); - var isNode = callback.nodeType == 1; - var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; - if (isNode) { - var node = callback, accum = [], col = 0; - callback = function(text, style) { - if (text == "\n") { - accum.push("
"); - col = 0; - return; - } - var escaped = ""; - // HTML-escape and replace tabs - for (var pos = 0;;) { - var idx = text.indexOf("\t", pos); - if (idx == -1) { - escaped += esc(text.slice(pos)); - col += text.length - pos; - break; - } else { - col += idx - pos; - escaped += esc(text.slice(pos, idx)); - var size = tabSize - col % tabSize; - col += size; - for (var i = 0; i < size; ++i) escaped += " "; - pos = idx + 1; - } - } - - if (style) - accum.push("" + escaped + ""); - else - accum.push(escaped); - }; - } - var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); - for (var i = 0, e = lines.length; i < e; ++i) { - if (i) callback("\n"); - var stream = new CodeMirror.StringStream(lines[i]); - while (!stream.eol()) { - var style = mode.token(stream, state); - callback(stream.current(), style, i, stream.start); - stream.start = stream.pos; - } - } - if (isNode) - node.innerHTML = accum.join(""); -}; From 306203bf79ddc6db4d1d13007b4292bc832a1720 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 11:01:32 -0800 Subject: [PATCH 0054/1055] Add initial .travis.yml file --- .travis.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..6d81c18eb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: java + +notifications: + email: false + +script: "mvn clean package" + +before_install: + - wget http://dl.google.com/android/android-sdk_r20.0.3-linux.tgz + - tar -zxf android-sdk_r20.0.3-linux.tgz + - export ANDROID_HOME=~/builds/github/android/android-sdk-linux + - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools + - android update sdk --filter 1,5 --no-ui --force \ No newline at end of file From 78ec7fe085ca1e441406eeebab651b752b60c1cd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 11:16:00 -0800 Subject: [PATCH 0055/1055] Upgrade target to android-16 --- app/project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/project.properties b/app/project.properties index 7f7ef9a9b..93dd5793b 100644 --- a/app/project.properties +++ b/app/project.properties @@ -8,7 +8,7 @@ # project structure. # Project target. -target=android-15 +target=android-16 android.library=false android.library.reference.1=../../Android-ViewPagerIndicator/library android.library.reference.2=../../ActionBarSherlock/library From cc22584a6b304757e4b9070c541dee4f196c5bee Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 11:17:31 -0800 Subject: [PATCH 0056/1055] Remove custom script --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d81c18eb..b2cc5ca06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ language: java notifications: email: false - -script: "mvn clean package" before_install: - wget http://dl.google.com/android/android-sdk_r20.0.3-linux.tgz From f5efa5864735f039b96d3ef19ac95f008d42dedb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 11:20:23 -0800 Subject: [PATCH 0057/1055] Upgrade test target version to 16 --- integration-tests/project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/project.properties b/integration-tests/project.properties index 8da376af8..895c9ce2e 100644 --- a/integration-tests/project.properties +++ b/integration-tests/project.properties @@ -8,4 +8,4 @@ # project structure. # Project target. -target=android-15 +target=android-16 From 8cfc4562b14571757156d4d03048b0b3de8517e5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 11:22:02 -0800 Subject: [PATCH 0058/1055] Upgrade sdk platform version to 16 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 076850c81..61a4ab0d5 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ true - 15 + 16 true From 4e0eef8fd3ef380a991dbf3e1e6aa3a5545a0e5e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 11:23:01 -0800 Subject: [PATCH 0059/1055] Upgrade target to 16 in default properties file at root --- default.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.properties b/default.properties index a923a3f11..37b6a1ab3 100644 --- a/default.properties +++ b/default.properties @@ -1,4 +1,4 @@ # A dummy file to force the Android Emulator Plugin to install SDK 15 # which we need for compiling against ABS 4. -target=android-15 +target=android-16 From aaa265869e7e6e9b56c3b8d9989ac758a412fe31 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 12:31:46 -0800 Subject: [PATCH 0060/1055] Upgrade travis to latest Android SDK --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2cc5ca06..31c2d9276 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ notifications: email: false before_install: - - wget http://dl.google.com/android/android-sdk_r20.0.3-linux.tgz - - tar -zxf android-sdk_r20.0.3-linux.tgz + - wget http://dl.google.com/android/android-sdk_r21-linux.tgz + - tar -zxf android-sdk_r21-linux.tgz - export ANDROID_HOME=~/builds/github/android/android-sdk-linux - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools - android update sdk --filter 1,5 --no-ui --force \ No newline at end of file From 18b0a4a8254bbfd6835e2833ba6d85e0574bb806 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 13:05:31 -0800 Subject: [PATCH 0061/1055] Correct typos in POM name elements --- integration-tests/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index c30d5b948..57ef8206e 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -11,7 +11,7 @@ apk github-android-integration-tests - Github-Android integration tests + GitHub-Android integration tests diff --git a/pom.xml b/pom.xml index 61a4ab0d5..869c370cf 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.github.github github-android-parent pom - Github Android app parent POM project + GitHub Android app parent POM project app From d938a774b2098ca83a631a93b4d02ffd4a26acf3 Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Thu, 15 Nov 2012 13:17:31 -0800 Subject: [PATCH 0062/1055] Update imports to fix problems with ADT v.21 Closes #273 --- .../java/com/github/mobile/ui/code/RepositoryCodeFragment.java | 2 +- .../com/github/mobile/ui/comment/CreateCommentActivity.java | 2 +- .../com/github/mobile/ui/comment/RenderedCommentFragment.java | 2 +- app/src/main/java/com/github/mobile/ui/commit/DiffStyler.java | 2 +- .../main/java/com/github/mobile/ui/gist/CreateGistActivity.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java index e4202f873..df5457378 100644 --- a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java +++ b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java @@ -31,12 +31,12 @@ import android.widget.ProgressBar; import android.widget.TextView; -import com.actionbarsherlock.R.color; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; +import com.github.mobile.R.color; import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.R.menu; diff --git a/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java b/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java index 4d15ddade..01b6317a7 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java @@ -25,11 +25,11 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; import com.github.mobile.R.id; +import com.github.mobile.R.menu; import com.github.mobile.R.string; import com.github.mobile.ui.TabPagerActivity; import com.github.mobile.util.AvatarLoader; import com.google.inject.Inject; -import com.viewpagerindicator.R.menu; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java index c83fb04a1..6290e4c13 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java +++ b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java @@ -25,9 +25,9 @@ import android.widget.ProgressBar; import android.widget.TextView; -import com.actionbarsherlock.R.id; import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; +import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.R.string; import com.github.mobile.ui.MarkdownLoader; diff --git a/app/src/main/java/com/github/mobile/ui/commit/DiffStyler.java b/app/src/main/java/com/github/mobile/ui/commit/DiffStyler.java index 498803e54..54b22fcd6 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/DiffStyler.java +++ b/app/src/main/java/com/github/mobile/ui/commit/DiffStyler.java @@ -19,7 +19,7 @@ import android.text.TextUtils; import android.widget.TextView; -import com.actionbarsherlock.R.color; +import com.github.mobile.R.color; import com.github.mobile.R.drawable; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java b/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java index ed429d1dd..be9f01296 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java @@ -24,10 +24,10 @@ import android.widget.CheckBox; import android.widget.EditText; -import com.actionbarsherlock.R.drawable; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; +import com.github.mobile.R.drawable; import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.R.menu; From f2c7a14e19382c80f616f5b2964a3b48faa8870a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 13:20:04 -0800 Subject: [PATCH 0063/1055] Update imports to use R classes from app package --- .../github/mobile/tests/commit/CreateCommentActivityTest.java | 2 +- .../com/github/mobile/tests/gist/CreateCommentActivityTest.java | 2 +- .../com/github/mobile/tests/gist/CreateGistActivityTest.java | 2 +- .../com/github/mobile/tests/gist/GistFilesViewActivityTest.java | 2 +- .../github/mobile/tests/issue/CreateCommentActivityTest.java | 2 +- .../com/github/mobile/tests/issue/EditIssueActivityTest.java | 2 +- .../java/com/github/mobile/tests/user/LoginActivityTest.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/integration-tests/src/main/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java index 7cb8342fa..6e1f9fb1f 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java @@ -19,9 +19,9 @@ import android.view.View; import android.widget.EditText; +import com.github.mobile.R.id; import com.github.mobile.tests.ActivityTest; import com.github.mobile.ui.commit.CreateCommentActivity; -import com.viewpagerindicator.R.id; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; diff --git a/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java index 75b98c1d5..58b48657e 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java @@ -19,9 +19,9 @@ import android.view.View; import android.widget.EditText; +import com.github.mobile.R.id; import com.github.mobile.tests.ActivityTest; import com.github.mobile.ui.gist.CreateCommentActivity; -import com.viewpagerindicator.R.id; import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.User; diff --git a/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateGistActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateGistActivityTest.java index 705426a91..d69e2c463 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateGistActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateGistActivityTest.java @@ -20,9 +20,9 @@ import android.view.View; import android.widget.EditText; +import com.github.mobile.R.id; import com.github.mobile.tests.ActivityTest; import com.github.mobile.ui.gist.CreateGistActivity; -import com.viewpagerindicator.R.id; /** * Tests of {@link CreateGistActivity} diff --git a/integration-tests/src/main/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java index a7649be90..5b72658da 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java @@ -17,11 +17,11 @@ import android.support.v4.view.ViewPager; +import com.github.mobile.R.id; import com.github.mobile.core.gist.GistStore; import com.github.mobile.tests.ActivityTest; import com.github.mobile.ui.gist.GistFilesViewActivity; import com.google.inject.Inject; -import com.viewpagerindicator.R.id; import java.util.LinkedHashMap; import java.util.Map; diff --git a/integration-tests/src/main/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java index 0d05c1c36..d6376041a 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java @@ -19,9 +19,9 @@ import android.view.View; import android.widget.EditText; +import com.github.mobile.R.id; import com.github.mobile.tests.ActivityTest; import com.github.mobile.ui.issue.CreateCommentActivity; -import com.viewpagerindicator.R.id; import org.eclipse.egit.github.core.RepositoryId; import org.eclipse.egit.github.core.User; diff --git a/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssueActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssueActivityTest.java index 35c8b76d1..cc219c174 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssueActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssueActivityTest.java @@ -19,9 +19,9 @@ import android.view.View; import android.widget.EditText; +import com.github.mobile.R.id; import com.github.mobile.tests.ActivityTest; import com.github.mobile.ui.issue.EditIssueActivity; -import com.viewpagerindicator.R.id; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; diff --git a/integration-tests/src/main/java/com/github/mobile/tests/user/LoginActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/user/LoginActivityTest.java index d8a12120e..7e73fbe5d 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/user/LoginActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/user/LoginActivityTest.java @@ -19,10 +19,10 @@ import android.view.View; import android.widget.EditText; +import com.github.mobile.R.id; import com.github.mobile.accounts.AccountUtils; import com.github.mobile.accounts.LoginActivity; import com.github.mobile.tests.ActivityTest; -import com.viewpagerindicator.R.id; /** * Tests of {@link LoginActivity} From aaefde8d2c97173fe690f88640e6c4b768bb9801 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 13:28:28 -0800 Subject: [PATCH 0064/1055] Put local Android paths first --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 31c2d9276..631c52674 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,5 +7,5 @@ before_install: - wget http://dl.google.com/android/android-sdk_r21-linux.tgz - tar -zxf android-sdk_r21-linux.tgz - export ANDROID_HOME=~/builds/github/android/android-sdk-linux - - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools + - export PATH=${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH} - android update sdk --filter 1,5 --no-ui --force \ No newline at end of file From 704f53a5213445983e22d3959132836a7c5961bd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 13:38:50 -0800 Subject: [PATCH 0065/1055] Log SDK install options --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 631c52674..c3a6ee3c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,6 @@ before_install: - tar -zxf android-sdk_r21-linux.tgz - export ANDROID_HOME=~/builds/github/android/android-sdk-linux - export PATH=${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH} + - android list sdk + - android list sdk -a - android update sdk --filter 1,5 --no-ui --force \ No newline at end of file From 9bf334d01d43a9561d4d79fddf85af026d1ec5d7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 13:41:14 -0800 Subject: [PATCH 0066/1055] Install 4th SDK option --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3a6ee3c6..bdd734ae1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,4 @@ before_install: - tar -zxf android-sdk_r21-linux.tgz - export ANDROID_HOME=~/builds/github/android/android-sdk-linux - export PATH=${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH} - - android list sdk - - android list sdk -a - - android update sdk --filter 1,5 --no-ui --force \ No newline at end of file + - android update sdk --filter 4 --no-ui --force \ No newline at end of file From 9e213058d2aaa025d902a5655fbc1cf87d6efd83 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 13:43:42 -0800 Subject: [PATCH 0067/1055] Install 1st SDK option --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bdd734ae1..566f727b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ before_install: - tar -zxf android-sdk_r21-linux.tgz - export ANDROID_HOME=~/builds/github/android/android-sdk-linux - export PATH=${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH} - - android update sdk --filter 4 --no-ui --force \ No newline at end of file + - android update sdk --filter 1,4 --no-ui --force \ No newline at end of file From b0cefcb3a83deaf194c412020977be399df1480d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 15 Nov 2012 14:45:05 -0800 Subject: [PATCH 0068/1055] Add build status image --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 87edcb90f..d1be14ae9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # GitHub Android App +[![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) + This repository contains the source code for the GitHub Android app. From b60e0cf68cebc114f1a23de1f30b8f9579efe023 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 16 Nov 2012 05:47:34 -0800 Subject: [PATCH 0069/1055] Add build status to the right of the header --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index d1be14ae9..6efc0746b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# GitHub Android App - -[![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) +# GitHub Android App [![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) This repository contains the source code for the GitHub Android app. From b5b8d4d123965c31544bec7ccb715b2e8ea2a9c9 Mon Sep 17 00:00:00 2001 From: Scoutman Date: Sat, 17 Nov 2012 16:05:02 -0800 Subject: [PATCH 0070/1055] Correct upper and lower case in German translation Closes #275 --- app/res/values-de/strings.xml | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/res/values-de/strings.xml b/app/res/values-de/strings.xml index 0a930c48c..d63f91290 100644 --- a/app/res/values-de/strings.xml +++ b/app/res/values-de/strings.xml @@ -99,10 +99,10 @@ Suchhistorie geleert Anmelden… Erstelle Gist… - erstellen + Erstellen Gist erstellen puts \'Hallo Welt!\' - öffentlicher Gist + Öffentlicher Gist dateiname.rb Gist Kommentare @@ -115,8 +115,8 @@ Filter Lesezeichen hinzufügen Kommentar - löschen - aktualisieren + Löschen + Aktualisieren Problem-Übersicht Lesezeichen Gists @@ -126,7 +126,7 @@ Probleme filtern Kommentar erstellen Ihren Kommentar eingeben - mehr zeigen… + Mehr zeigen… Repositories Probleme Markierungen bearbeiten @@ -136,7 +136,7 @@ Beschreibung erstellt mit Android Titel - bearbeiten + Bearbeiten Füge Gist als Favorit hinzu… Entferne favorisierten Gist… Konten @@ -144,7 +144,7 @@ Meilenstein wählen Markierung wählen Branch oder Tag wählen - keine Meilensteine + Keine Meilensteine Niemand zugewiesen ist zugewiesen Keine Gists gefunden @@ -159,12 +159,12 @@ Filter als Lesezeichen gespeichert Letzte Status: - offen - geschlossen + Offen + Geschlossen Zugewiesen an: - jeder + Jeder Meilenstein: - keine(r) + Keine(r) Markierungen: Einloggen Neu bei GitHub? <a href=\"https://github.com/plans\">Hier klicken</a> um sich anzumelden @@ -189,12 +189,12 @@ erstellt\u0020 aktualisiert\u0020 eröffnet\u0020 - leeren - offene Probleme - geschlossene Probleme + Leeren + Offene Probleme + Geschlossene Probleme Lesezeichen entfernen - speichern - annehmen + Speichern + Annehmen Markierungen: Verantwortlicher Meilenstein @@ -203,14 +203,14 @@ Sind Sie sicher, dass Sie dieses Problem neu öffnen möchten? Problem schließen Problem neu öffnen - geschlossen + Geschlossen Keine Beschreibung angegeben. - schließen - neu öffnen + Schließen + Neu öffnen Ungültige GitHub URL Die folgende URL konnte von der Anwendung nicht geöffnet werden:\n{0} Zuletzt Angesehen - abbrechen + Abbrechen App Konflikt Eine andere App ist derzeit für die Anmeldung bei GitHub konfiguriert.\n\nSie müssen diese App aus dem Bereich Konten & Synchronisierung entfernen und diese App deinstallieren, bevor Sie die GitHub App verwenden können. Öffne {0}… From de346de92fdc7704f9bab9a319e85a9664d96ac3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 Nov 2012 15:09:51 -0800 Subject: [PATCH 0071/1055] Add styleguide to blacklist --- .../main/java/com/github/mobile/core/repo/RepositoryUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/core/repo/RepositoryUtils.java b/app/src/main/java/com/github/mobile/core/repo/RepositoryUtils.java index efc21ff2e..d4e65b712 100644 --- a/app/src/main/java/com/github/mobile/core/repo/RepositoryUtils.java +++ b/app/src/main/java/com/github/mobile/core/repo/RepositoryUtils.java @@ -75,6 +75,7 @@ public static boolean isValidOwner(final String name) { || "security".equals(name) // || "settings".equals(name) // || "stars".equals(name) // + || "styleguide".equals(name) // || "timeline".equals(name) // || "training".equals(name) // || "users".equals(name) // From ecb86f2340bca88763769e883e60e94b26351401 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 20 Nov 2012 09:32:35 -0800 Subject: [PATCH 0072/1055] Upgrade to wishlist 0.6 --- app/pom.xml | 2 +- .../com/github/mobile/ui/commit/CommitFileListAdapter.java | 1 + .../main/java/com/github/mobile/ui/ref/CodeTreeAdapter.java | 6 +++--- .../java/com/github/mobile/ui/user/NewsListAdapter.java | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/pom.xml b/app/pom.xml index 5676947cb..cec610acf 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -85,7 +85,7 @@ com.github.kevinsawicki wishlist - 0.4 + 0.6 apklib diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java b/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java index e02bc489a..45d667cc0 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java @@ -15,6 +15,7 @@ */ package com.github.mobile.ui.commit; +import static com.github.kevinsawicki.wishlist.ViewUpdater.FORMAT_INT; import android.content.res.Resources; import android.text.TextUtils; import android.view.LayoutInflater; diff --git a/app/src/main/java/com/github/mobile/ui/ref/CodeTreeAdapter.java b/app/src/main/java/com/github/mobile/ui/ref/CodeTreeAdapter.java index 48c9b006c..fdd39c630 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/CodeTreeAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/ref/CodeTreeAdapter.java @@ -156,10 +156,10 @@ protected View initialize(final int type, View view) { @Override protected void update(final int position, final Object item, final int type) { if (indented) - view.setPadding(indentedPaddingLeft, paddingTop, paddingRight, - paddingBottom); + updater.view.setPadding(indentedPaddingLeft, paddingTop, + paddingRight, paddingBottom); else - view.setPadding(paddingLeft, paddingTop, paddingRight, + updater.view.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); switch (type) { diff --git a/app/src/main/java/com/github/mobile/ui/user/NewsListAdapter.java b/app/src/main/java/com/github/mobile/ui/user/NewsListAdapter.java index 527afde5b..b5336297a 100644 --- a/app/src/main/java/com/github/mobile/ui/user/NewsListAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/user/NewsListAdapter.java @@ -15,6 +15,7 @@ */ package com.github.mobile.ui.user; +import static com.github.kevinsawicki.wishlist.ViewUpdater.FORMAT_INT; import static com.github.mobile.util.TypefaceUtils.ICON_ADD_MEMBER; import static com.github.mobile.util.TypefaceUtils.ICON_COMMENT; import static com.github.mobile.util.TypefaceUtils.ICON_CREATE; From afa6973beae706813189f83d1bc0fdb638e652e0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 20 Nov 2012 14:48:11 -0800 Subject: [PATCH 0073/1055] Remove iteration over character set when generating headers This was unnecessary and also previously caused repositories starting with numbers to be dropped from the headers. Closes #282 --- .../ui/repo/RepositoryListFragment.java | 70 ++++++++++++------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java index 40363f30e..90861f1f7 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java @@ -153,39 +153,57 @@ private void updateHeaders(final List repos) { .getWrappedAdapter(); adapter.clearHeaders(); - char start = 'a'; - Repository previous = null; - for (int i = 0; i < repos.size(); i++) { - Repository repository = repos.get(i); + if (repos.isEmpty()) + return; - if (recentRepos.contains(repository.getId())) { - previous = repository; - continue; - } + // Add recent header if at least one recent repository + Repository first = repos.get(0); + if (recentRepos.contains(first)) + adapter.registerHeader(first, getString(string.recently_viewed)); + + // Advance past all recent repositories + int index; + Repository current = null; + for (index = 0; index < repos.size(); index++) { + Repository repository = repos.get(index); + if (recentRepos.contains(repository.getId())) + current = repository; + else + break; + } + + if (index >= repos.size()) + return; - char repoStart = Character.toLowerCase(repository.getName().charAt( - 0)); - if (repoStart < start) { - previous = repository; + if (current != null) + adapter.registerNoSeparator(current); + + // Register header for first character + current = repos.get(index); + char start = Character.toLowerCase(current.getName().charAt(0)); + adapter.registerHeader(current, + Character.toString(start).toUpperCase(US)); + + char previousHeader = start; + for (index = index + 1; index < repos.size(); index++) { + current = repos.get(index); + char repoStart = Character.toLowerCase(current.getName().charAt(0)); + if (repoStart <= start) continue; - } - adapter.registerHeader(repository, Character.toString(repoStart) + // Don't include separator for the last element of the previous + // character + if (previousHeader != repoStart) + adapter.registerNoSeparator(repos.get(index - 1)); + + adapter.registerHeader(current, Character.toString(repoStart) .toUpperCase(US)); - if (previous != null) - adapter.registerNoSeparator(previous); - start = repoStart; - if (start == 'z') - break; - start++; - previous = repository; + previousHeader = repoStart; + start = repoStart++; } - if (!repos.isEmpty()) { - Repository first = repos.get(0); - if (recentRepos.contains(first)) - adapter.registerHeader(first, getString(string.recently_viewed)); - } + // Don't include separator for last element + adapter.registerNoSeparator(repos.get(repos.size() - 1)); } @Override From 8ee39c0c5c053a4be7f05ab9accaf44df7947498 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 20 Nov 2012 15:40:41 -0800 Subject: [PATCH 0074/1055] Add header separator to repo_search layout --- app/res/layout/repo_search.xml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/app/res/layout/repo_search.xml b/app/res/layout/repo_search.xml index 050d40bb0..36467c048 100644 --- a/app/res/layout/repo_search.xml +++ b/app/res/layout/repo_search.xml @@ -14,14 +14,22 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + + - + - \ No newline at end of file + \ No newline at end of file From b65a0c0544b62459f192ee46c6680cb1ae7f8b6f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 20 Nov 2012 15:42:08 -0800 Subject: [PATCH 0075/1055] Remove unused layout --- app/res/layout/branch_item.xml | 82 ---------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 app/res/layout/branch_item.xml diff --git a/app/res/layout/branch_item.xml b/app/res/layout/branch_item.xml deleted file mode 100644 index 3db8daad3..000000000 --- a/app/res/layout/branch_item.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 9318ec336c31bb41605af3eb17fddc2024067cd7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 20 Nov 2012 18:13:28 -0800 Subject: [PATCH 0076/1055] Upgrade to android-maven-plugin 3.4.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 869c370cf..226bcafc5 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ com.jayway.maven.plugins.android.generation2 android-maven-plugin - 3.3.0 + 3.4.1 true From 92f9f9a9adbf443d6a4ff0abe631ae80936b812e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 21 Nov 2012 18:01:44 -0800 Subject: [PATCH 0077/1055] Remove unneeded Inject annotation and add missing Override annotation --- .../java/com/github/mobile/ui/user/MyFollowingFragment.java | 3 +-- .../java/com/github/mobile/ui/user/UserFollowingFragment.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/user/MyFollowingFragment.java b/app/src/main/java/com/github/mobile/ui/user/MyFollowingFragment.java index 09678fd98..c60e38f0b 100644 --- a/app/src/main/java/com/github/mobile/ui/user/MyFollowingFragment.java +++ b/app/src/main/java/com/github/mobile/ui/user/MyFollowingFragment.java @@ -17,7 +17,6 @@ import com.github.mobile.core.ResourcePager; import com.github.mobile.core.user.UserPager; -import com.google.inject.Inject; import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; @@ -27,7 +26,7 @@ */ public class MyFollowingFragment extends FollowingFragment { - @Inject + @Override protected ResourcePager createPager() { return new UserPager() { diff --git a/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java b/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java index 512d79e11..39d92e33c 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java +++ b/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java @@ -19,7 +19,6 @@ import com.github.mobile.core.ResourcePager; import com.github.mobile.core.user.UserPager; -import com.google.inject.Inject; import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; @@ -34,7 +33,7 @@ public class UserFollowingFragment extends FollowingFragment { @InjectExtra(EXTRA_USER) private User user; - @Inject + @Override protected ResourcePager createPager() { return new UserPager() { From 5d9dbfc4bc64401151dbb96f24769aaed4270642 Mon Sep 17 00:00:00 2001 From: Wang Xuerui Date: Mon, 26 Nov 2012 13:29:16 -0800 Subject: [PATCH 0078/1055] Update zh-rCN translation Closes #287 --- app/res/values-zh-rCN/strings.xml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/res/values-zh-rCN/strings.xml b/app/res/values-zh-rCN/strings.xml index edafca4a2..dcbcbad6c 100644 --- a/app/res/values-zh-rCN/strings.xml +++ b/app/res/values-zh-rCN/strings.xml @@ -39,6 +39,13 @@ 文件加载失败 代码加载失败 分支与标签加载失败 + 关注失败 + 取消关注失败 + 关注状态检查失败 + 星标加注失败 + 星标移除失败 + 加注星标状态检查失败 + Markdown 渲染失败 @@ -133,9 +140,7 @@ 从 Android 创建的 Gist 标题 编辑 - 加注星标 为 Gist 加注星标… - 移除星标 为 Gist 移除星标… 账户 选择被指派人 @@ -175,6 +180,10 @@ Ta关注的 关注我的 我关注的 + 关注 + 取消关注 + 加注星标 + 移除星标 成员 正在关闭 Issue… 正在重新开放 Issue… @@ -220,6 +229,10 @@ 启用自动折行 禁用自动折行 代码 + 正在关注… + 正在取消关注… + 正在加注星标… + 正在移除星标… 版本库 @@ -240,5 +253,9 @@ 已加星标 所有 + 分享 + 显示密码 + 书写 + 预览 From ef163ad1d91d1ba340673be120a4b4f5ba1d9e32 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 08:52:25 -0800 Subject: [PATCH 0079/1055] Add comment about keeping targetSdkVersion at 16 --- app/AndroidManifest.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index eb1a4fdeb..b38783c33 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -4,6 +4,8 @@ android:versionCode="1100" android:versionName="1.5" > + From 880fd83162459b1b728c0e3ada5a0438f8b01b34 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 08:56:27 -0800 Subject: [PATCH 0080/1055] Remove missing activity The previous create issue was merged with the edit issue activity but the old activity was not removed from the manifest. --- app/AndroidManifest.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index b38783c33..66375b498 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -88,15 +88,6 @@ - - - - - - - From ca46dd2cc081f6d647a26f1b2bc1edb533a1b15c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 08:58:05 -0800 Subject: [PATCH 0081/1055] Specify default locale when calling toLowerCase --- app/src/main/java/com/github/mobile/ui/StyledText.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/ui/StyledText.java b/app/src/main/java/com/github/mobile/ui/StyledText.java index 41b72bd3e..fb5e4de6c 100644 --- a/app/src/main/java/com/github/mobile/ui/StyledText.java +++ b/app/src/main/java/com/github/mobile/ui/StyledText.java @@ -29,6 +29,7 @@ import com.github.mobile.util.TimeUtils; import java.util.Date; +import java.util.Locale; /** * Helpers on top of {@link SpannableStringBuilder} @@ -177,7 +178,8 @@ public StyledText append(final Date date) { final int timeLength = time.length(); if (length() > 0 && timeLength > 0 && Character.isUpperCase(time.charAt(0))) { - append(time.subSequence(0, 1).toString().toLowerCase()); + append(time.subSequence(0, 1).toString() + .toLowerCase(Locale.getDefault())); append(time.subSequence(1, timeLength)); } else append(time); From 3c619ab721ccca5383271575bb87be652136e1d7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 08:59:21 -0800 Subject: [PATCH 0082/1055] =?UTF-8?q?Use=20=E2=80=A6=20instead=20of=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/res/values-it/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/res/values-it/strings.xml b/app/res/values-it/strings.xml index d1730c9b0..cffd879e8 100644 --- a/app/res/values-it/strings.xml +++ b/app/res/values-it/strings.xml @@ -231,10 +231,10 @@ Abilita il wrapping Disabilita il wrapping Codice - Caricamento tra i following... - Cancellazione dai following... - Caricamento tra i preferiti... - Cancellazione dai preferiti... + Caricamento tra i following… + Cancellazione dai following… + Caricamento tra i preferiti… + Cancellazione dai preferiti… Repository From 80aa48a8dcd043498d3c6d0ef283f3bf7c6eaa91 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:01:49 -0800 Subject: [PATCH 0083/1055] Add default title to menu items --- app/res/menu/repository_star.xml | 3 ++- app/res/menu/user_follow.xml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/res/menu/repository_star.xml b/app/res/menu/repository_star.xml index a7753713d..9fa4970b4 100644 --- a/app/res/menu/repository_star.xml +++ b/app/res/menu/repository_star.xml @@ -18,6 +18,7 @@ + android:showAsAction="never" + android:title="@string/star"/> \ No newline at end of file diff --git a/app/res/menu/user_follow.xml b/app/res/menu/user_follow.xml index e22b3d11a..92763da77 100644 --- a/app/res/menu/user_follow.xml +++ b/app/res/menu/user_follow.xml @@ -18,6 +18,7 @@ + android:showAsAction="never" + android:title="@string/follow" /> \ No newline at end of file From 08227e3ecc9c05c298aad2ef6b207cc36e6b77e2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:06:41 -0800 Subject: [PATCH 0084/1055] Coerce SourceEditor.getWrap() into a boolean --- app/assets/source-editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/source-editor.js b/app/assets/source-editor.js index 374eb8955..a0ac69adb 100644 --- a/app/assets/source-editor.js +++ b/app/assets/source-editor.js @@ -157,7 +157,7 @@ window.onload = function() { config.readOnly = "nocursor"; config.lineNumbers = true; config.autofocus = false; - config.lineWrapping = SourceEditor.getWrap(); + config.lineWrapping = !!SourceEditor.getWrap(); config.dragDrop = false; var editor = CodeMirror(document.body, config); From 2e85f50ad476f583c4d23abd12b69d0fc49eb208 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:09:17 -0800 Subject: [PATCH 0085/1055] Remove initial comment with instructions --- app/project.properties | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/project.properties b/app/project.properties index 93dd5793b..3c3f85961 100644 --- a/app/project.properties +++ b/app/project.properties @@ -1,12 +1,3 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - # Project target. target=android-16 android.library=false From 90a2bf0229e1f8dbf746e87d845bf8b938c420dd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:11:50 -0800 Subject: [PATCH 0086/1055] Remove scope loop and replace with call to containsAll --- .../com/github/mobile/accounts/AccountAuthenticator.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java index 70c0fd7ed..e75c1115b 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java @@ -104,10 +104,7 @@ private boolean isValidAuthorization(final Authorization auth, if (scopes == null || scopes.size() != requiredScopes.size()) return false; - for (String required : requiredScopes) - if (!scopes.contains(required)) - return false; - return true; + return scopes.containsAll(requiredScopes); } private Intent createLoginIntent(AccountAuthenticatorResponse response) { From 96cb1b3d5d7ee8120b12d8629f3f30ba75a4d8ac Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:12:50 -0800 Subject: [PATCH 0087/1055] Finalize parameters consistently --- .../java/com/github/mobile/accounts/AccountAuthenticator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java index e75c1115b..731ff4321 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java @@ -67,7 +67,7 @@ public AccountAuthenticator(final Context context) { @Override public Bundle addAccount(final AccountAuthenticatorResponse response, final String accountType, final String authTokenType, - String[] requiredFeatures, Bundle options) + final String[] requiredFeatures, final Bundle options) throws NetworkErrorException { final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(PARAM_AUTHTOKEN_TYPE, authTokenType); From 658206235a08be17eb7969eb4b1f4580653c71ba Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:13:34 -0800 Subject: [PATCH 0088/1055] Upgrade user agent version to 1.6 --- app/src/main/java/com/github/mobile/DefaultClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/DefaultClient.java b/app/src/main/java/com/github/mobile/DefaultClient.java index 8d5548474..04540e93e 100644 --- a/app/src/main/java/com/github/mobile/DefaultClient.java +++ b/app/src/main/java/com/github/mobile/DefaultClient.java @@ -29,7 +29,7 @@ */ public class DefaultClient extends GitHubClient { - private static final String USER_AGENT = "GitHubAndroid/1.4"; + private static final String USER_AGENT = "GitHubAndroid/1.6"; static { // Disable http.keepAlive on Froyo and below From 8c0ceb0f5ac74ebc818b98e09042fa48782152a7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:20:52 -0800 Subject: [PATCH 0089/1055] Move bundle update outside of try block --- .../mobile/accounts/AccountAuthenticator.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java index 731ff4321..934432b3e 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java @@ -173,24 +173,25 @@ public Bundle getAuthToken(AccountAuthenticatorResponse response, OAuthService service = new OAuthService(client); List scopes = Arrays.asList("repo", "user", "gist"); + String authToken; try { - String authToken = getAuthorization(service, scopes); + authToken = getAuthorization(service, scopes); if (TextUtils.isEmpty(authToken)) authToken = createAuthorization(service, scopes); - - if (TextUtils.isEmpty(authToken)) - bundle.putParcelable(KEY_INTENT, createLoginIntent(response)); - else { - bundle.putString(KEY_ACCOUNT_NAME, account.name); - bundle.putString(KEY_ACCOUNT_TYPE, ACCOUNT_TYPE); - bundle.putString(KEY_AUTHTOKEN, authToken); - am.clearPassword(account); - } - return bundle; } catch (IOException e) { Log.e(TAG, "Authorization retrieval failed", e); throw new NetworkErrorException(e); } + + if (TextUtils.isEmpty(authToken)) + bundle.putParcelable(KEY_INTENT, createLoginIntent(response)); + else { + bundle.putString(KEY_ACCOUNT_NAME, account.name); + bundle.putString(KEY_ACCOUNT_TYPE, ACCOUNT_TYPE); + bundle.putString(KEY_AUTHTOKEN, authToken); + am.clearPassword(account); + } + return bundle; } @Override From 09c4274e9217fc9b67e674c13da0b8cf81928f61 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:22:15 -0800 Subject: [PATCH 0090/1055] Remove unneeded username variable --- .../java/com/github/mobile/accounts/AccountAuthenticator.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java index 934432b3e..e74bb0bd7 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java @@ -160,16 +160,14 @@ public Bundle getAuthToken(AccountAuthenticatorResponse response, return bundle; AccountManager am = AccountManager.get(context); - String username = account.name; String password = am.getPassword(account); - if (TextUtils.isEmpty(password)) { bundle.putParcelable(KEY_INTENT, createLoginIntent(response)); return bundle; } DefaultClient client = new DefaultClient(); - client.setCredentials(username, password); + client.setCredentials(account.name, password); OAuthService service = new OAuthService(client); List scopes = Arrays.asList("repo", "user", "gist"); From 4c6f9c378a7290a3ff47f9eac2454689cc7ca628 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:23:50 -0800 Subject: [PATCH 0091/1055] Mark all pareters as final in AccountAuthenticator --- .../mobile/accounts/AccountAuthenticator.java | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java index e74bb0bd7..70983317d 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java @@ -78,14 +78,15 @@ public Bundle addAccount(final AccountAuthenticatorResponse response, } @Override - public Bundle confirmCredentials(AccountAuthenticatorResponse response, - Account account, Bundle options) { + public Bundle confirmCredentials( + final AccountAuthenticatorResponse response, final Account account, + final Bundle options) { return null; } @Override - public Bundle editProperties(AccountAuthenticatorResponse response, - String accountType) { + public Bundle editProperties(final AccountAuthenticatorResponse response, + final String accountType) { return null; } @@ -107,7 +108,7 @@ private boolean isValidAuthorization(final Authorization auth, return scopes.containsAll(requiredScopes); } - private Intent createLoginIntent(AccountAuthenticatorResponse response) { + private Intent createLoginIntent(final AccountAuthenticatorResponse response) { final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(PARAM_AUTHTOKEN_TYPE, ACCOUNT_TYPE); intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); @@ -122,8 +123,8 @@ private Intent createLoginIntent(AccountAuthenticatorResponse response) { * @return token or null if none found * @throws IOException */ - private String getAuthorization(OAuthService service, List scopes) - throws IOException { + private String getAuthorization(final OAuthService service, + final List scopes) throws IOException { for (Authorization auth : service.getAuthorizations()) if (isValidAuthorization(auth, scopes)) return auth.getToken(); @@ -138,8 +139,8 @@ private String getAuthorization(OAuthService service, List scopes) * @return created token * @throws IOException */ - private String createAuthorization(OAuthService service, List scopes) - throws IOException { + private String createAuthorization(final OAuthService service, + final List scopes) throws IOException { Authorization auth = new Authorization(); auth.setNote(APP_NOTE); auth.setNoteUrl(APP_NOTE_URL); @@ -149,9 +150,9 @@ private String createAuthorization(OAuthService service, List scopes) } @Override - public Bundle getAuthToken(AccountAuthenticatorResponse response, - Account account, String authTokenType, Bundle options) - throws NetworkErrorException { + public Bundle getAuthToken(final AccountAuthenticatorResponse response, + final Account account, final String authTokenType, + final Bundle options) throws NetworkErrorException { Log.d(TAG, "Retrieving OAuth2 token"); final Bundle bundle = new Bundle(); @@ -193,7 +194,7 @@ public Bundle getAuthToken(AccountAuthenticatorResponse response, } @Override - public String getAuthTokenLabel(String authTokenType) { + public String getAuthTokenLabel(final String authTokenType) { if (ACCOUNT_TYPE.equals(authTokenType)) return authTokenType; else @@ -201,16 +202,18 @@ public String getAuthTokenLabel(String authTokenType) { } @Override - public Bundle hasFeatures(AccountAuthenticatorResponse response, - Account account, String[] features) throws NetworkErrorException { + public Bundle hasFeatures(final AccountAuthenticatorResponse response, + final Account account, final String[] features) + throws NetworkErrorException { final Bundle result = new Bundle(); result.putBoolean(KEY_BOOLEAN_RESULT, false); return result; } @Override - public Bundle updateCredentials(AccountAuthenticatorResponse response, - Account account, String authTokenType, Bundle options) { + public Bundle updateCredentials( + final AccountAuthenticatorResponse response, final Account account, + final String authTokenType, final Bundle options) { final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); From 121bce7cd28ed50dc537e1172b32338d75feb4c1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:27:16 -0800 Subject: [PATCH 0092/1055] Guard against missing activity --- .../com/github/mobile/ui/comment/RawCommentFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java index cea93430c..7b21f04d6 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java +++ b/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java @@ -15,6 +15,7 @@ */ package com.github.mobile.ui.comment; +import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.view.LayoutInflater; @@ -45,7 +46,9 @@ public void onViewCreated(View view, Bundle savedInstanceState) { @Override public void afterTextChanged(Editable s) { - getActivity().invalidateOptionsMenu(); + Activity activity = getActivity(); + if (activity != null) + activity.invalidateOptionsMenu(); } }); } From 79f4a88394716d697fd2b2f3d43e8d64950efce2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:32:55 -0800 Subject: [PATCH 0093/1055] Invalid options menu on sherlock activity --- .../java/com/github/mobile/ui/comment/RawCommentFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java index 7b21f04d6..5a5bf4abb 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java +++ b/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java @@ -15,7 +15,6 @@ */ package com.github.mobile.ui.comment; -import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.view.LayoutInflater; @@ -23,6 +22,7 @@ import android.view.ViewGroup; import android.widget.EditText; +import com.actionbarsherlock.app.SherlockFragmentActivity; import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -46,7 +46,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) { @Override public void afterTextChanged(Editable s) { - Activity activity = getActivity(); + SherlockFragmentActivity activity = getSherlockActivity(); if (activity != null) activity.invalidateOptionsMenu(); } From 8dd0f7fbdba196feb3d5df1ee0e23bf50b3ede8c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:33:12 -0800 Subject: [PATCH 0094/1055] Remove InjectExtra annotation and use helper from super class --- .../com/github/mobile/ui/DialogFragment.java | 20 ++++++++++++++++++- .../ui/code/RepositoryCodeFragment.java | 10 +++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragment.java b/app/src/main/java/com/github/mobile/ui/DialogFragment.java index 94fadd6e1..0c4a0114a 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragment.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragment.java @@ -15,9 +15,12 @@ */ package com.github.mobile.ui; +import android.app.Activity; +import android.os.Bundle; + import com.github.rtyley.android.sherlock.roboguice.fragment.RoboSherlockFragment; -import android.os.Bundle; +import java.io.Serializable; /** * Base fragment capable of receiving dialog callbacks @@ -38,4 +41,19 @@ protected boolean isUsable() { public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { // Intentionally left blank } + + /** + * Get serializable extra from activity's intent + * + * @param name + * @return extra + */ + @SuppressWarnings("unchecked") + protected V getSerializableExtra(final String name) { + Activity activity = getActivity(); + if (activity != null) + return (V) activity.getIntent().getSerializableExtra(name); + else + return null; + } } diff --git a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java index df5457378..732fd70e2 100644 --- a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java +++ b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java @@ -64,8 +64,6 @@ import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.service.DataService; -import roboguice.inject.InjectExtra; - /** * Fragment to display a repository's source code tree */ @@ -94,7 +92,6 @@ public class RepositoryCodeFragment extends DialogFragment implements private Folder folder; - @InjectExtra(EXTRA_REPOSITORY) private Repository repository; @Inject @@ -102,6 +99,13 @@ public class RepositoryCodeFragment extends DialogFragment implements private RefDialog dialog; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + repository = getSerializableExtra(EXTRA_REPOSITORY); + } + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); From 71be91e82d399aab1df452747305c72b08038fd6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:50:30 -0800 Subject: [PATCH 0095/1055] Remove unneeded view parameter --- .../main/java/com/github/mobile/ui/ref/RefDialogFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/ui/ref/RefDialogFragment.java b/app/src/main/java/com/github/mobile/ui/ref/RefDialogFragment.java index 58a5b904b..4b546d0a1 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/RefDialogFragment.java +++ b/app/src/main/java/com/github/mobile/ui/ref/RefDialogFragment.java @@ -72,7 +72,7 @@ protected int[] getChildViewIds() { protected View initialize(View view) { view = super.initialize(view); - TypefaceUtils.setOcticons(textView(view, 0)); + TypefaceUtils.setOcticons(textView(0)); return view; } From 66fd1abbd1e53146cfcff4fccec80916d3934fe2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 09:54:04 -0800 Subject: [PATCH 0096/1055] Extend DialogFragment in ItemListFragment Allows downstream classes to use helpers --- .../com/github/mobile/ui/ItemListFragment.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java b/app/src/main/java/com/github/mobile/ui/ItemListFragment.java index 7183a65c3..271538126 100644 --- a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/ItemListFragment.java @@ -41,7 +41,6 @@ import com.github.mobile.R.menu; import com.github.mobile.ThrowableLoader; import com.github.mobile.util.ToastUtils; -import com.github.rtyley.android.sherlock.roboguice.fragment.RoboSherlockFragment; import java.util.Collections; import java.util.List; @@ -52,8 +51,8 @@ * * @param */ -public abstract class ItemListFragment extends RoboSherlockFragment - implements LoaderCallbacks> { +public abstract class ItemListFragment extends DialogFragment implements + LoaderCallbacks> { private static final String FORCE_REFRESH = "forceRefresh"; @@ -431,13 +430,4 @@ protected ItemListFragment setEmptyText(final int resId) { */ public void onListItemClick(ListView l, View v, int position, long id) { } - - /** - * Is this fragment still part of an activity and usable from the UI-thread? - * - * @return true if usable on the UI-thread, false otherwise - */ - protected boolean isUsable() { - return getActivity() != null; - } } From af531f981afa6f9e4b1c90830b0154d780d5b797 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 10:12:27 -0800 Subject: [PATCH 0097/1055] Use helper from parent class for getting intent extras --- .../com/github/mobile/ui/DialogFragment.java | 14 +++++++++++++ .../mobile/ui/DialogFragmentActivity.java | 20 +++++++++++++++++++ .../ui/commit/CommitCompareListFragment.java | 14 +++++++++---- .../ui/commit/CommitCompareViewActivity.java | 5 ++--- .../mobile/ui/commit/CommitListFragment.java | 11 +++++++--- .../mobile/ui/gist/GistFileFragment.java | 14 +++++++++---- .../mobile/ui/gist/GistFilesViewActivity.java | 6 +++--- .../mobile/ui/issue/IssueBrowseActivity.java | 9 ++++----- .../mobile/ui/issue/IssuesFragment.java | 12 +++++++---- .../mobile/ui/issue/IssuesViewActivity.java | 12 +++++------ .../ui/repo/RepositoryNewsFragment.java | 11 +++++++--- .../ui/repo/UserRepositoryListFragment.java | 13 ++++++++---- .../mobile/ui/user/UserFollowersFragment.java | 11 +++++++--- .../mobile/ui/user/UserFollowingFragment.java | 11 +++++++--- 14 files changed, 118 insertions(+), 45 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragment.java b/app/src/main/java/com/github/mobile/ui/DialogFragment.java index 0c4a0114a..3a9b97819 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragment.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragment.java @@ -56,4 +56,18 @@ protected V getSerializableExtra(final String name) { else return null; } + + /** + * Get string extra from activity's intent + * + * @param name + * @return extra + */ + protected String getStringExtra(final String name) { + Activity activity = getActivity(); + if (activity != null) + return activity.getIntent().getStringExtra(name); + else + return null; + } } diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java b/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java index 597c2e9a0..c15fe4085 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java @@ -61,6 +61,26 @@ protected int getIntExtra(final String name) { return getIntent().getIntExtra(name, -1); } + /** + * Get intent extra + * + * @param name + * @return int array + */ + protected int[] getIntArrayExtra(final String name) { + return getIntent().getIntArrayExtra(name); + } + + /** + * Get intent extra + * + * @param name + * @return boolean array + */ + protected boolean[] getBooleanArrayExtra(final String name) { + return getIntent().getBooleanArrayExtra(name); + } + /** * Get intent extra * diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java index 0dd548681..8ac31bec2 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java @@ -19,6 +19,7 @@ import static com.github.mobile.Intents.EXTRA_HEAD; import static com.github.mobile.Intents.EXTRA_REPOSITORY; import android.accounts.Account; +import android.app.Activity; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; @@ -56,7 +57,6 @@ import org.eclipse.egit.github.core.RepositoryCommit; import org.eclipse.egit.github.core.RepositoryCommitCompare; -import roboguice.inject.InjectExtra; import roboguice.inject.InjectView; /** @@ -73,13 +73,10 @@ public class CommitCompareListFragment extends DialogFragment implements @InjectView(id.pb_loading) private ProgressBar progress; - @InjectExtra(EXTRA_REPOSITORY) private Repository repository; - @InjectExtra(EXTRA_BASE) private String base; - @InjectExtra(EXTRA_HEAD) private String head; @Inject @@ -89,6 +86,15 @@ public class CommitCompareListFragment extends DialogFragment implements private RepositoryCommitCompare compare; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + repository = getSerializableExtra(EXTRA_REPOSITORY); + base = getStringExtra(EXTRA_BASE); + head = getStringExtra(EXTRA_HEAD); + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java index f29ab1261..bfd71a3bd 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java @@ -36,8 +36,6 @@ import org.eclipse.egit.github.core.Repository; -import roboguice.inject.InjectExtra; - /** * Activity to display a comparison between two commits */ @@ -60,7 +58,6 @@ public static Intent createIntent(final Repository repository, return builder.toIntent(); } - @InjectExtra(EXTRA_REPOSITORY) private Repository repository; @Inject @@ -72,6 +69,8 @@ public static Intent createIntent(final Repository repository, protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + repository = getSerializableExtra(EXTRA_REPOSITORY); + setContentView(layout.commit_compare); ActionBar actionBar = getSupportActionBar(); diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java index e14a32efb..390aec8ca 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java @@ -19,6 +19,7 @@ import static com.github.mobile.Intents.EXTRA_REPOSITORY; import static com.github.mobile.RequestCodes.COMMIT_VIEW; import static com.github.mobile.RequestCodes.REF_UPDATE; +import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v4.content.Loader; @@ -62,8 +63,6 @@ import org.eclipse.egit.github.core.service.DataService; import org.eclipse.egit.github.core.service.RepositoryService; -import roboguice.inject.InjectExtra; - /** * Fragment to display a list of repository commits */ @@ -82,7 +81,6 @@ public class CommitListFragment extends PagedItemFragment @Inject private CommitStore store; - @InjectExtra(EXTRA_REPOSITORY) private Repository repository; private RefDialog dialog; @@ -101,6 +99,13 @@ public class CommitListFragment extends PagedItemFragment private String ref; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + repository = getSerializableExtra(EXTRA_REPOSITORY); + } + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java index c9b4ca826..a6ae1a7b4 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java @@ -19,6 +19,7 @@ import static com.github.mobile.Intents.EXTRA_GIST_ID; import static com.github.mobile.util.PreferenceUtils.WRAP; import android.accounts.Account; +import android.app.Activity; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; @@ -36,10 +37,10 @@ import com.github.mobile.R.string; import com.github.mobile.accounts.AuthenticatedUserTask; import com.github.mobile.core.gist.GistStore; +import com.github.mobile.ui.DialogFragment; import com.github.mobile.util.PreferenceUtils; import com.github.mobile.util.SourceEditor; import com.github.mobile.util.ToastUtils; -import com.github.rtyley.android.sherlock.roboguice.fragment.RoboSherlockFragment; import com.google.inject.Inject; import java.io.IOException; @@ -48,19 +49,17 @@ import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.GistFile; -import roboguice.inject.InjectExtra; import roboguice.inject.InjectView; /** * Fragment to display the content of a file in a Gist */ -public class GistFileFragment extends RoboSherlockFragment implements +public class GistFileFragment extends DialogFragment implements OnSharedPreferenceChangeListener { @InjectView(id.wv_code) private WebView webView; - @InjectExtra(EXTRA_GIST_ID) private String gistId; private GistFile file; @@ -76,6 +75,13 @@ public class GistFileFragment extends RoboSherlockFragment implements private MenuItem wrapItem; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + gistId = getStringExtra(EXTRA_GIST_ID); + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java b/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java index e87fe8aa7..b8852340f 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java @@ -44,7 +44,6 @@ import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.User; -import roboguice.inject.InjectExtra; import roboguice.inject.InjectView; /** @@ -64,10 +63,8 @@ public static Intent createIntent(Gist gist, int position) { .add(EXTRA_POSITION, position).toIntent(); } - @InjectExtra(EXTRA_GIST_ID) private String gistId; - @InjectExtra(EXTRA_POSITION) private int initialPosition; @InjectView(id.vp_pages) @@ -96,6 +93,9 @@ public static Intent createIntent(Gist gist, int position) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + gistId = getStringExtra(EXTRA_GIST_ID); + initialPosition = getIntExtra(EXTRA_POSITION); + setContentView(layout.pager_with_title); if (initialPosition < 0) diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java index b9903270d..832184afb 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java @@ -27,18 +27,16 @@ import com.github.mobile.Intents.Builder; import com.github.mobile.R.layout; import com.github.mobile.core.issue.IssueFilter; +import com.github.mobile.ui.DialogFragmentActivity; import com.github.mobile.util.AvatarLoader; -import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockFragmentActivity; import com.google.inject.Inject; import org.eclipse.egit.github.core.Repository; -import roboguice.inject.InjectExtra; - /** * Activity for browsing a list of issues scoped to a single {@link IssueFilter} */ -public class IssueBrowseActivity extends RoboSherlockFragmentActivity { +public class IssueBrowseActivity extends DialogFragmentActivity { /** * Create intent to browse the filtered issues @@ -51,7 +49,6 @@ public static Intent createIntent(IssueFilter filter) { .add(EXTRA_ISSUE_FILTER, filter).toIntent(); } - @InjectExtra(EXTRA_REPOSITORY) private Repository repo; @Inject @@ -61,6 +58,8 @@ public static Intent createIntent(IssueFilter filter) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + repo = getSerializableExtra(EXTRA_REPOSITORY); + setContentView(layout.repo_issue_list); ActionBar actionBar = getSupportActionBar(); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java index d89af43ab..2030764f4 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java @@ -62,8 +62,6 @@ import org.eclipse.egit.github.core.client.PageIterator; import org.eclipse.egit.github.core.service.IssueService; -import roboguice.inject.InjectExtra; - /** * Fragment to display a list of issues */ @@ -78,10 +76,8 @@ public class IssuesFragment extends PagedItemFragment { @Inject private IssueStore store; - @InjectExtra(value = EXTRA_ISSUE_FILTER, optional = true) private IssueFilter filter; - @InjectExtra(EXTRA_REPOSITORY) private Repository repository; private View filterHeader; @@ -101,6 +97,14 @@ public class IssuesFragment extends PagedItemFragment { @Inject private AvatarLoader avatars; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + filter = getSerializableExtra(EXTRA_ISSUE_FILTER); + repository = getSerializableExtra(EXTRA_REPOSITORY); + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java index af0ee007a..aac1d1420 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java @@ -48,7 +48,6 @@ import org.eclipse.egit.github.core.RepositoryIssue; import org.eclipse.egit.github.core.User; -import roboguice.inject.InjectExtra; import roboguice.inject.InjectView; /** @@ -150,19 +149,14 @@ public static Intent createIntent(Collection issues, @InjectView(id.vp_pages) private ViewPager pager; - @InjectExtra(EXTRA_ISSUE_NUMBERS) private int[] issueNumbers; - @InjectExtra(EXTRA_PULL_REQUESTS) private boolean[] pullRequests; - @InjectExtra(value = EXTRA_REPOSITORIES, optional = true) private ArrayList repoIds; - @InjectExtra(value = EXTRA_REPOSITORY, optional = true) private Repository repo; - @InjectExtra(EXTRA_POSITION) private int initialPosition; @Inject @@ -181,6 +175,12 @@ public static Intent createIntent(Collection issues, protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + issueNumbers = getIntArrayExtra(EXTRA_ISSUE_NUMBERS); + pullRequests = getBooleanArrayExtra(EXTRA_PULL_REQUESTS); + repoIds = getSerializableExtra(EXTRA_REPOSITORIES); + repo = getSerializableExtra(EXTRA_REPOSITORY); + initialPosition = getIntExtra(EXTRA_POSITION); + setContentView(layout.pager); if (repo != null) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java index 94bd53034..346b70f2c 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java @@ -16,6 +16,7 @@ package com.github.mobile.ui.repo; import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import android.app.Activity; import com.github.mobile.core.ResourcePager; import com.github.mobile.ui.NewsFragment; @@ -27,16 +28,20 @@ import org.eclipse.egit.github.core.client.PageIterator; import org.eclipse.egit.github.core.event.Event; -import roboguice.inject.InjectExtra; - /** * Fragment to display a news feed for a specific repository */ public class RepositoryNewsFragment extends NewsFragment { - @InjectExtra(EXTRA_REPOSITORY) private Repository repo; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + repo = getSerializableExtra(EXTRA_REPOSITORY); + } + @Override protected ResourcePager createPager() { return new EventPager() { diff --git a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java index e4eb0d83f..1aa0afb81 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java @@ -15,15 +15,16 @@ */ package com.github.mobile.ui.repo; +import static com.github.mobile.Intents.EXTRA_USER; import static com.github.mobile.RequestCodes.REPOSITORY_VIEW; import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; +import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.Intents; import com.github.mobile.R.string; import com.github.mobile.core.ResourcePager; import com.github.mobile.ui.PagedItemFragment; @@ -36,8 +37,6 @@ import org.eclipse.egit.github.core.client.PageIterator; import org.eclipse.egit.github.core.service.RepositoryService; -import roboguice.inject.InjectExtra; - /** * Fragment to display a list of repositories for a {@link User} */ @@ -46,9 +45,15 @@ public class UserRepositoryListFragment extends PagedItemFragment { @Inject private RepositoryService service; - @InjectExtra(Intents.EXTRA_USER) private User user; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + user = getSerializableExtra(EXTRA_USER); + } + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); diff --git a/app/src/main/java/com/github/mobile/ui/user/UserFollowersFragment.java b/app/src/main/java/com/github/mobile/ui/user/UserFollowersFragment.java index 5b379d31e..30da0858f 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserFollowersFragment.java +++ b/app/src/main/java/com/github/mobile/ui/user/UserFollowersFragment.java @@ -16,6 +16,7 @@ package com.github.mobile.ui.user; import static com.github.mobile.Intents.EXTRA_USER; +import android.app.Activity; import com.github.mobile.core.ResourcePager; import com.github.mobile.core.user.UserPager; @@ -23,16 +24,20 @@ import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; -import roboguice.inject.InjectExtra; - /** * Fragment to display a list of followers */ public class UserFollowersFragment extends FollowersFragment { - @InjectExtra(EXTRA_USER) private User user; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + user = getSerializableExtra(EXTRA_USER); + } + @Override protected ResourcePager createPager() { return new UserPager() { diff --git a/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java b/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java index 39d92e33c..9df454ad2 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java +++ b/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java @@ -16,6 +16,7 @@ package com.github.mobile.ui.user; import static com.github.mobile.Intents.EXTRA_USER; +import android.app.Activity; import com.github.mobile.core.ResourcePager; import com.github.mobile.core.user.UserPager; @@ -23,16 +24,20 @@ import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; -import roboguice.inject.InjectExtra; - /** * Fragment to display the users being followed by a specific user */ public class UserFollowingFragment extends FollowingFragment { - @InjectExtra(EXTRA_USER) private User user; + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + user = getSerializableExtra(EXTRA_USER); + } + @Override protected ResourcePager createPager() { return new UserPager() { From f8010241cded7fe50b63613e4a0f4f8bee0076f6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 10:24:36 -0800 Subject: [PATCH 0098/1055] Use helpers from parent class for setting view fields --- .../ui/commit/CommitCompareListFragment.java | 9 +++++---- .../ui/commit/CommitDiffListFragment.java | 9 +++++---- .../mobile/ui/gist/GistFileFragment.java | 7 ++++--- .../mobile/ui/gist/GistFilesViewActivity.java | 9 ++++----- .../github/mobile/ui/gist/GistFragment.java | 9 +++++---- .../mobile/ui/issue/EditIssueActivity.java | 19 +++++++++---------- .../ui/issue/EditIssuesFilterActivity.java | 11 +++++------ .../github/mobile/ui/issue/IssueFragment.java | 9 +++++---- .../mobile/ui/issue/IssuesViewActivity.java | 5 ++--- 9 files changed, 44 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java index 8ac31bec2..0016b8eb4 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java @@ -34,6 +34,7 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; +import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -57,8 +58,6 @@ import org.eclipse.egit.github.core.RepositoryCommit; import org.eclipse.egit.github.core.RepositoryCommitCompare; -import roboguice.inject.InjectView; - /** * Fragment to display a list of commits being compared */ @@ -67,10 +66,8 @@ public class CommitCompareListFragment extends DialogFragment implements private DiffStyler diffStyler; - @InjectView(android.R.id.list) private ListView list; - @InjectView(id.pb_loading) private ProgressBar progress; private Repository repository; @@ -211,6 +208,10 @@ private void addFileStatHeader(List files, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + ViewFinder finder = new ViewFinder(view); + list = finder.find(android.R.id.list); + progress = finder.find(id.pb_loading); + LayoutInflater inflater = getActivity().getLayoutInflater(); list.setOnItemClickListener(this); diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java index b4b43f308..346a923cf 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java @@ -42,6 +42,7 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; +import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -72,8 +73,6 @@ import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryCommit; -import roboguice.inject.InjectView; - /** * Fragment to display commit details with diff output */ @@ -82,10 +81,8 @@ public class CommitDiffListFragment extends DialogFragment implements private DiffStyler diffStyler; - @InjectView(android.R.id.list) private ListView list; - @InjectView(id.pb_loading) private ProgressBar progress; private Repository repository; @@ -364,6 +361,10 @@ private void updateItems(List comments, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + ViewFinder finder = new ViewFinder(view); + list = finder.find(android.R.id.list); + progress = finder.find(id.pb_loading); + diffStyler = new DiffStyler(getResources()); list.setOnItemClickListener(this); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java index a6ae1a7b4..bb3f5275e 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java @@ -31,6 +31,7 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; +import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.R.menu; @@ -49,15 +50,12 @@ import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.GistFile; -import roboguice.inject.InjectView; - /** * Fragment to display the content of a file in a Gist */ public class GistFileFragment extends DialogFragment implements OnSharedPreferenceChangeListener { - @InjectView(id.wv_code) private WebView webView; private String gistId; @@ -193,6 +191,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + ViewFinder finder = new ViewFinder(view); + webView = finder.find(id.wv_code); + editor = new SourceEditor(webView); editor.setWrap(PreferenceUtils.getCodePreferences(getActivity()) .getBoolean(WRAP, false)); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java b/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java index b8852340f..4a4d25dd7 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java @@ -44,8 +44,6 @@ import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.User; -import roboguice.inject.InjectView; - /** * Activity to page through the content of all the files in a Gist */ @@ -67,13 +65,10 @@ public static Intent createIntent(Gist gist, int position) { private int initialPosition; - @InjectView(id.vp_pages) private ViewPager pager; - @InjectView(id.pb_loading) private ProgressBar loadingBar; - @InjectView(id.tpi_header) private TitlePageIndicator indicator; private Gist gist; @@ -98,6 +93,10 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(layout.pager_with_title); + pager = finder.find(id.vp_pages); + loadingBar = finder.find(id.pb_loading); + indicator = finder.find(id.tpi_header); + if (initialPosition < 0) initialPosition = 0; diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java index 24c8902a1..78952a5aa 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java @@ -38,6 +38,7 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; +import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -70,8 +71,6 @@ import org.eclipse.egit.github.core.GistFile; import org.eclipse.egit.github.core.User; -import roboguice.inject.InjectView; - /** * Activity to display an existing Gist */ @@ -83,10 +82,8 @@ public class GistFragment extends DialogFragment implements OnItemClickListener private Gist gist; - @InjectView(android.R.id.list) private ListView list; - @InjectView(id.pb_loading) private ProgressBar progress; @Inject @@ -148,6 +145,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + ViewFinder finder = new ViewFinder(view); + list = finder.find(android.R.id.list); + progress = finder.find(id.pb_loading); + Activity activity = getActivity(); adapter = new HeaderFooterListAdapter(list, new CommentListAdapter(activity.getLayoutInflater(), avatars, diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java b/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java index 4269df5e7..1dd3416d6 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java @@ -62,8 +62,6 @@ import org.eclipse.egit.github.core.service.LabelService; import org.eclipse.egit.github.core.service.MilestoneService; -import roboguice.inject.InjectView; - /** * Activity to edit or create an issue */ @@ -102,28 +100,20 @@ public static Intent createIntent(final Issue issue, return builder.toIntent(); } - @InjectView(id.et_issue_title) private EditText titleText; - @InjectView(id.et_issue_body) private EditText bodyText; - @InjectView(id.ll_milestone_graph) private View milestoneGraph; - @InjectView(id.tv_milestone) private TextView milestoneText; - @InjectView(id.v_closed) private View milestoneClosed; - @InjectView(id.iv_assignee_avatar) private ImageView assigneeAvatar; - @InjectView(id.tv_assignee_name) private TextView assigneeText; - @InjectView(id.tv_labels) private TextView labelsText; @Inject @@ -156,6 +146,15 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(layout.issue_edit); + titleText = finder.find(id.et_issue_title); + bodyText = finder.find(id.et_issue_body); + milestoneGraph = finder.find(id.ll_milestone_graph); + milestoneText = finder.find(id.tv_milestone); + milestoneClosed = finder.find(id.v_closed); + assigneeAvatar = finder.find(id.iv_assignee_avatar); + assigneeText = finder.find(id.tv_assignee_name); + labelsText = finder.find(id.tv_labels); + Intent intent = getIntent(); if (savedInstanceState != null) diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java b/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java index 968d41f7c..1ad614f7e 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java @@ -50,8 +50,6 @@ import org.eclipse.egit.github.core.service.LabelService; import org.eclipse.egit.github.core.service.MilestoneService; -import roboguice.inject.InjectView; - /** * Activity to create or edit an issues filter for a repository */ @@ -94,16 +92,12 @@ public static Intent createIntent(IssueFilter filter) { private IssueFilter filter; - @InjectView(id.tv_labels) private TextView labelsText; - @InjectView(id.tv_milestone) private TextView milestoneText; - @InjectView(id.tv_assignee) private TextView assigneeText; - @InjectView(id.iv_avatar) private ImageView avatarView; @Override @@ -112,6 +106,11 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(layout.issues_filter_edit); + labelsText = finder.find(id.tv_labels); + milestoneText = finder.find(id.tv_milestone); + assigneeText = finder.find(id.tv_assignee); + avatarView = finder.find(id.iv_avatar); + if (savedInstanceState != null) filter = (IssueFilter) savedInstanceState .getSerializable(EXTRA_ISSUE_FILTER); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index 787d5b6bf..e471e118d 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -50,6 +50,7 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; +import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.drawable; import com.github.mobile.R.id; @@ -83,8 +84,6 @@ import org.eclipse.egit.github.core.RepositoryId; import org.eclipse.egit.github.core.User; -import roboguice.inject.InjectView; - /** * Fragment to display an issue */ @@ -106,10 +105,8 @@ public class IssueFragment extends DialogFragment { @Inject private IssueStore store; - @InjectView(android.R.id.list) private ListView list; - @InjectView(id.pb_loading) private ProgressBar progress; private View headerView; @@ -255,6 +252,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + ViewFinder finder = new ViewFinder(view); + list = finder.find(android.R.id.list); + progress = finder.find(id.pb_loading); + LayoutInflater inflater = getLayoutInflater(savedInstanceState); headerView = inflater.inflate(layout.issue_header, null); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java index aac1d1420..b152b705e 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java @@ -48,8 +48,6 @@ import org.eclipse.egit.github.core.RepositoryIssue; import org.eclipse.egit.github.core.User; -import roboguice.inject.InjectView; - /** * Activity to display a collection of issues or pull requests in a pager */ @@ -146,7 +144,6 @@ public static Intent createIntent(Collection issues, return builder.toIntent(); } - @InjectView(id.vp_pages) private ViewPager pager; private int[] issueNumbers; @@ -183,6 +180,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(layout.pager); + pager = finder.find(id.vp_pages); + if (repo != null) adapter = new IssuesPagerAdapter(this, repo, issueNumbers); else From efeac65ec353f9293e7b83b4c55e29f1298394e2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 10:28:23 -0800 Subject: [PATCH 0099/1055] Use view finder from parent class --- .../java/com/github/mobile/ui/DialogFragment.java | 15 +++++++++++++++ .../mobile/ui/code/RepositoryCodeFragment.java | 2 -- .../mobile/ui/comment/RawCommentFragment.java | 6 ++---- .../ui/commit/CommitCompareListFragment.java | 2 -- .../mobile/ui/commit/CommitDiffListFragment.java | 2 -- .../mobile/ui/commit/CommitListFragment.java | 2 -- .../github/mobile/ui/gist/GistFileFragment.java | 2 -- .../com/github/mobile/ui/gist/GistFragment.java | 2 -- .../com/github/mobile/ui/issue/IssueFragment.java | 2 -- 9 files changed, 17 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragment.java b/app/src/main/java/com/github/mobile/ui/DialogFragment.java index 3a9b97819..c891e5915 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragment.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragment.java @@ -17,7 +17,9 @@ import android.app.Activity; import android.os.Bundle; +import android.view.View; +import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.rtyley.android.sherlock.roboguice.fragment.RoboSherlockFragment; import java.io.Serializable; @@ -28,6 +30,12 @@ public abstract class DialogFragment extends RoboSherlockFragment implements DialogResultListener { + /** + * View finder bound to the value last specified to + * {@link #onViewCreated(android.view.View, Bundle)} + */ + protected ViewFinder finder; + /** * Is this fragment usable from the UI-thread * @@ -70,4 +78,11 @@ protected String getStringExtra(final String name) { else return null; } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + finder = new ViewFinder(view); + } } diff --git a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java index 732fd70e2..cb5573a5b 100644 --- a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java +++ b/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java @@ -34,7 +34,6 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.color; import com.github.mobile.R.id; @@ -217,7 +216,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); progressView = finder.find(id.pb_loading); listView = finder.find(android.R.id.list); listView.setOnItemClickListener(this); diff --git a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java index 5a5bf4abb..42fd3e75f 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java +++ b/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java @@ -23,16 +23,15 @@ import android.widget.EditText; import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.mobile.R.id; import com.github.mobile.R.layout; +import com.github.mobile.ui.DialogFragment; import com.github.mobile.ui.TextWatcherAdapter; -import com.github.rtyley.android.sherlock.roboguice.fragment.RoboSherlockFragment; /** * Fragment to display raw comment text */ -public class RawCommentFragment extends RoboSherlockFragment { +public class RawCommentFragment extends DialogFragment { private EditText commentText; @@ -40,7 +39,6 @@ public class RawCommentFragment extends RoboSherlockFragment { public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); commentText = finder.find(id.et_comment); commentText.addTextChangedListener(new TextWatcherAdapter() { diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java index 0016b8eb4..be2899a14 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java @@ -34,7 +34,6 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -208,7 +207,6 @@ private void addFileStatHeader(List files, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); list = finder.find(android.R.id.list); progress = finder.find(id.pb_loading); diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java index 346a923cf..fa8a5143f 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java @@ -42,7 +42,6 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -361,7 +360,6 @@ private void updateItems(List comments, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); list = finder.find(android.R.id.list); progress = finder.find(id.pb_loading); diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java index 390aec8ca..91710ffbb 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java @@ -32,7 +32,6 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -263,7 +262,6 @@ public ItemListFragment setListShown(boolean shown, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); branchFooterView = finder.find(id.rl_branch); branchView = finder.find(id.tv_branch); branchIconView = finder.find(id.tv_branch_icon); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java index bb3f5275e..a07093ae2 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java @@ -31,7 +31,6 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.R.menu; @@ -191,7 +190,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); webView = finder.find(id.wv_code); editor = new SourceEditor(webView); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java index 78952a5aa..42dfc2272 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java @@ -38,7 +38,6 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -145,7 +144,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); list = finder.find(android.R.id.list); progress = finder.find(id.pb_loading); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index e471e118d..5217f800a 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -50,7 +50,6 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; -import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.drawable; import com.github.mobile.R.id; @@ -252,7 +251,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); list = finder.find(android.R.id.list); progress = finder.find(id.pb_loading); From 4bf2db0e5dd509a34b24225d6ec31bf634758765 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 13:56:04 -0800 Subject: [PATCH 0100/1055] Hide soft keyboard when switching to preview tab --- .../mobile/ui/comment/RenderedCommentFragment.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java index 6290e4c13..74a7fe544 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java +++ b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java @@ -25,15 +25,15 @@ import android.widget.ProgressBar; import android.widget.TextView; -import com.github.kevinsawicki.wishlist.ViewFinder; +import com.github.kevinsawicki.wishlist.Keyboard; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.R.string; +import com.github.mobile.ui.DialogFragment; import com.github.mobile.ui.MarkdownLoader; import com.github.mobile.util.HttpImageGetter; import com.github.mobile.util.ToastUtils; -import com.github.rtyley.android.sherlock.roboguice.fragment.RoboSherlockFragment; import java.io.Serializable; @@ -42,7 +42,7 @@ /** * Fragment to display rendered comment fragment */ -public class RenderedCommentFragment extends RoboSherlockFragment implements +public class RenderedCommentFragment extends DialogFragment implements LoaderCallbacks { private static final String ARG_TEXT = "text"; @@ -61,10 +61,10 @@ public void onActivityCreated(Bundle savedInstanceState) { imageGetter = new HttpImageGetter(getActivity()); } + @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - ViewFinder finder = new ViewFinder(view); progress = finder.find(id.pb_loading); bodyText = finder.find(id.tv_comment_body); } @@ -81,6 +81,7 @@ public void setText(final String raw, final IRepositoryIdProvider repo) { if (repo instanceof Serializable) args.putSerializable(ARG_REPO, (Serializable) repo); getLoaderManager().restartLoader(0, args, this); + Keyboard.hideSoftInput(bodyText); showLoading(true); } From 43a254b8351c752a4a9c90f99a063ce7886ca0ed Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 13:59:17 -0800 Subject: [PATCH 0101/1055] Place Google Play image to right of build status --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 6efc0746b..138521aad 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,7 @@ -# GitHub Android App [![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) +# GitHub Android App [![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) [![Google Play](http://developer.android.com/images/brand/en_app_rgb_wo_45.png)](https://play.google.com/store/apps/details?id=com.github.mobile) This repository contains the source code for the GitHub Android app. - - - - From 623df0004348641ddaa7f0aaa52b9e25835716ae Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 14:00:24 -0800 Subject: [PATCH 0102/1055] Upgrade to wishlist 0.7 --- app/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pom.xml b/app/pom.xml index cec610acf..a466cf80d 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -85,7 +85,7 @@ com.github.kevinsawicki wishlist - 0.6 + 0.7 apklib From a1eba3095e7dcb314904a95f3424ddece5909f04 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 15:17:34 -0800 Subject: [PATCH 0103/1055] Place Google play link to left of build status --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 138521aad..869413fc3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GitHub Android App [![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) [![Google Play](http://developer.android.com/images/brand/en_app_rgb_wo_45.png)](https://play.google.com/store/apps/details?id=com.github.mobile) +# GitHub Android App [![Google Play](http://developer.android.com/images/brand/en_app_rgb_wo_45.png)](https://play.google.com/store/apps/details?id=com.github.mobile) [![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) This repository contains the source code for the GitHub Android app. From 48c9536157d8b0d08893efb9903ffb29a746532a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 15:18:15 -0800 Subject: [PATCH 0104/1055] Use generic Google play image --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 869413fc3..3661c5b10 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GitHub Android App [![Google Play](http://developer.android.com/images/brand/en_app_rgb_wo_45.png)](https://play.google.com/store/apps/details?id=com.github.mobile) [![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) +# GitHub Android App [![Google Play](http://developer.android.com/images/brand/en_generic_rgb_wo_45.png)](https://play.google.com/store/apps/details?id=com.github.mobile) [![Build Status](https://travis-ci.org/github/android.png)](https://travis-ci.org/github/android) This repository contains the source code for the GitHub Android app. From 11e34acf516872610fb46156460efc8953a52958 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 27 Nov 2012 15:18:45 -0800 Subject: [PATCH 0105/1055] Remove extra newlines --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 3661c5b10..3153c91cb 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ This repository contains the source code for the GitHub Android app. - Please see the [issues](https://github.com/github/android/issues) section to report any bugs or feature requests and to see the list of known issues. @@ -63,4 +62,3 @@ Please fork this repository and contribute back using Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed. - From ff53af9e290d1fec15e08c46113ff8882802a0b0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Nov 2012 14:23:14 -0800 Subject: [PATCH 0106/1055] Add support for opening Gists from http links --- app/AndroidManifest.xml | 18 ++++++ .../mobile/core/gist/GistUriMatcher.java | 58 +++++++++++++++++ .../mobile/ui/user/UriLauncherActivity.java | 64 +++++++++++-------- 3 files changed, 114 insertions(+), 26 deletions(-) create mode 100644 app/src/main/java/com/github/mobile/core/gist/GistUriMatcher.java diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index 66375b498..f5e91d59f 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -249,6 +249,24 @@ + + + + + + + + + + + + + + segments = uri.getPathSegments(); + if (segments == null) + return null; + if (segments.size() != 1) + return null; + + String gistId = segments.get(0); + if (TextUtils.isEmpty(gistId)) + return null; + + if (TextUtils.isDigitsOnly(gistId)) + return new Gist().setId(gistId); + + if (PATTERN.matcher(gistId).matches()) + return new Gist().setId(gistId); + + return null; + } +} diff --git a/app/src/main/java/com/github/mobile/ui/user/UriLauncherActivity.java b/app/src/main/java/com/github/mobile/ui/user/UriLauncherActivity.java index d53a459ef..0e96efa16 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UriLauncherActivity.java +++ b/app/src/main/java/com/github/mobile/ui/user/UriLauncherActivity.java @@ -18,6 +18,7 @@ import static android.content.DialogInterface.BUTTON_POSITIVE; import static android.content.Intent.ACTION_VIEW; import static android.content.Intent.CATEGORY_BROWSABLE; +import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_GISTS; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; @@ -30,17 +31,20 @@ import com.github.mobile.R.string; import com.github.mobile.core.commit.CommitMatch; import com.github.mobile.core.commit.CommitUriMatcher; +import com.github.mobile.core.gist.GistUriMatcher; import com.github.mobile.core.issue.IssueUriMatcher; import com.github.mobile.core.repo.RepositoryUriMatcher; import com.github.mobile.core.user.UserUriMatcher; import com.github.mobile.ui.LightAlertDialog; import com.github.mobile.ui.commit.CommitViewActivity; +import com.github.mobile.ui.gist.GistsViewActivity; import com.github.mobile.ui.issue.IssuesViewActivity; import com.github.mobile.ui.repo.RepositoryViewActivity; import java.net.URI; import java.text.MessageFormat; +import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryIssue; import org.eclipse.egit.github.core.User; @@ -56,35 +60,43 @@ protected void onCreate(Bundle savedInstanceState) { final Intent intent = getIntent(); final Uri data = intent.getData(); + if (HOST_GISTS.equals(data.getHost())) { + Gist gist = GistUriMatcher.getGist(data); + if (gist != null) { + startActivity(GistsViewActivity.createIntent(gist)); + finish(); + return; + } + } else { + RepositoryIssue issue = IssueUriMatcher.getIssue(data); + if (issue != null) { + startActivity(IssuesViewActivity.createIntent(issue, + issue.getRepository())); + finish(); + return; + } - RepositoryIssue issue = IssueUriMatcher.getIssue(data); - if (issue != null) { - startActivity(IssuesViewActivity.createIntent(issue, - issue.getRepository())); - finish(); - return; - } - - Repository repository = RepositoryUriMatcher.getRepository(data); - if (repository != null) { - startActivity(RepositoryViewActivity.createIntent(repository)); - finish(); - return; - } + Repository repository = RepositoryUriMatcher.getRepository(data); + if (repository != null) { + startActivity(RepositoryViewActivity.createIntent(repository)); + finish(); + return; + } - User user = UserUriMatcher.getUser(data); - if (user != null) { - startActivity(UserViewActivity.createIntent(user)); - finish(); - return; - } + User user = UserUriMatcher.getUser(data); + if (user != null) { + startActivity(UserViewActivity.createIntent(user)); + finish(); + return; + } - CommitMatch commit = CommitUriMatcher.getCommit(data); - if (commit != null) { - startActivity(CommitViewActivity.createIntent(commit.repository, - commit.commit)); - finish(); - return; + CommitMatch commit = CommitUriMatcher.getCommit(data); + if (commit != null) { + startActivity(CommitViewActivity.createIntent( + commit.repository, commit.commit)); + finish(); + return; + } } if (!intent.hasCategory(CATEGORY_BROWSABLE)) { From 118acb4608b4763a496e69b44dbe953758721b00 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Nov 2012 14:24:35 -0800 Subject: [PATCH 0107/1055] Correct comment wrapping --- .../main/java/com/github/mobile/ui/gist/GistsViewActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java index 08fd0ad9b..b7a472434 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java @@ -112,8 +112,7 @@ protected void onCreate(Bundle savedInstanceState) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Support opening this activity with a single Gist that may be present - // in the intent but not currently present - // in the store + // in the intent but not currently present in the store if (gists == null && gist != null) { String id = gist.getId(); if (gist.getCreatedAt() != null) { From f6726e8e9ddf490e7e4d32d80fcc4c4e191b10e2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Nov 2012 14:24:44 -0800 Subject: [PATCH 0108/1055] Add missing override annotation --- .../main/java/com/github/mobile/ui/gist/GistsViewActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java index b7a472434..669cab25e 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java @@ -193,6 +193,7 @@ public void startActivity(Intent intent) { super.startActivity(intent); } + @Override protected FragmentProvider getProvider() { return adapter; } From 6716c2213b9b0c53151cf5ba532e66e18d650c8e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Nov 2012 14:38:52 -0800 Subject: [PATCH 0109/1055] Fire back to acitivity when Gist loads Ensures the avatar is updated when the Gist is initially opened with just an id and then a full load begins --- .../github/mobile/core/OnLoadListener.java | 31 +++++++++++++++ .../github/mobile/ui/gist/GistFragment.java | 8 ++++ .../mobile/ui/gist/GistsViewActivity.java | 38 ++++++++++++------- 3 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 app/src/main/java/com/github/mobile/core/OnLoadListener.java diff --git a/app/src/main/java/com/github/mobile/core/OnLoadListener.java b/app/src/main/java/com/github/mobile/core/OnLoadListener.java new file mode 100644 index 000000000..b43a0f029 --- /dev/null +++ b/app/src/main/java/com/github/mobile/core/OnLoadListener.java @@ -0,0 +1,31 @@ +/* + * Copyright 2012 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.core; + +/** + * Load listener callback + * + * @param + */ +public interface OnLoadListener { + + /** + * Loaded callback + * + * @param data + */ + void loaded(V data); +} diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java index 42dfc2272..4d9325b80 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java @@ -25,6 +25,7 @@ import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; +import android.support.v4.app.FragmentActivity; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -44,6 +45,7 @@ import com.github.mobile.R.menu; import com.github.mobile.R.string; import com.github.mobile.accounts.AccountUtils; +import com.github.mobile.core.OnLoadListener; import com.github.mobile.core.gist.FullGist; import com.github.mobile.core.gist.GistStore; import com.github.mobile.core.gist.RefreshGistTask; @@ -387,6 +389,7 @@ protected void onException(Exception e) throws RuntimeException { ToastUtils.show(getActivity(), e, string.error_gist_load); } + @SuppressWarnings("unchecked") @Override protected void onSuccess(FullGist fullGist) throws Exception { super.onSuccess(fullGist); @@ -394,6 +397,11 @@ protected void onSuccess(FullGist fullGist) throws Exception { if (!isUsable()) return; + FragmentActivity activity = getActivity(); + if (activity instanceof OnLoadListener) + ((OnLoadListener) activity) + .loaded(fullGist.getGist()); + starred = fullGist.isStarred(); loadFinished = true; gist = fullGist.getGist(); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java index 669cab25e..63138ffbd 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java @@ -31,6 +31,7 @@ import com.github.mobile.R.id; import com.github.mobile.R.layout; import com.github.mobile.R.string; +import com.github.mobile.core.OnLoadListener; import com.github.mobile.core.gist.GistStore; import com.github.mobile.ui.ConfirmDialogFragment; import com.github.mobile.ui.FragmentProvider; @@ -48,7 +49,8 @@ /** * Activity to display a collection of Gists in a pager */ -public class GistsViewActivity extends PagerActivity { +public class GistsViewActivity extends PagerActivity implements + OnLoadListener { private static final int REQUEST_CONFIRM_DELETE = 1; @@ -166,9 +168,27 @@ public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { public void onPageSelected(int position) { super.onPageSelected(position); - ActionBar actionBar = getSupportActionBar(); String gistId = gists[position]; Gist gist = store.getGist(gistId); + updateActionBar(gist, gistId); + } + + @Override + public void startActivity(Intent intent) { + Intent converted = urlLauncher.convert(intent); + if (converted != null) + super.startActivity(converted); + else + super.startActivity(intent); + } + + @Override + protected FragmentProvider getProvider() { + return adapter; + } + + private void updateActionBar(Gist gist, String gistId) { + ActionBar actionBar = getSupportActionBar(); if (gist == null) { actionBar.setSubtitle(null); actionBar.setLogo(null); @@ -185,16 +205,8 @@ public void onPageSelected(int position) { } @Override - public void startActivity(Intent intent) { - Intent converted = urlLauncher.convert(intent); - if (converted != null) - super.startActivity(converted); - else - super.startActivity(intent); - } - - @Override - protected FragmentProvider getProvider() { - return adapter; + public void loaded(Gist gist) { + if (gists[pager.getCurrentItem()].equals(gist.getId())) + updateActionBar(gist, gist.getId()); } } From 79433b1b1868e71abf871bdbd9e97dcde9cc5b5f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Nov 2012 14:40:31 -0800 Subject: [PATCH 0110/1055] Don't get Gist id until needed --- .../main/java/com/github/mobile/ui/gist/GistsViewActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java index 63138ffbd..19982071c 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java @@ -116,9 +116,8 @@ protected void onCreate(Bundle savedInstanceState) { // Support opening this activity with a single Gist that may be present // in the intent but not currently present in the store if (gists == null && gist != null) { - String id = gist.getId(); if (gist.getCreatedAt() != null) { - Gist stored = store.getGist(id); + Gist stored = store.getGist(gist.getId()); if (stored == null) store.addGist(gist); } From 971b43b7d8d3160c2c9d9da82c5e6053bbdacd30 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Nov 2012 14:52:14 -0800 Subject: [PATCH 0111/1055] Add unit tests of GistUriMatcher --- .../mobile/tests/gist/GistUriMatcherTest.java | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 integration-tests/src/main/java/com/github/mobile/tests/gist/GistUriMatcherTest.java diff --git a/integration-tests/src/main/java/com/github/mobile/tests/gist/GistUriMatcherTest.java b/integration-tests/src/main/java/com/github/mobile/tests/gist/GistUriMatcherTest.java new file mode 100644 index 000000000..2d1b305fa --- /dev/null +++ b/integration-tests/src/main/java/com/github/mobile/tests/gist/GistUriMatcherTest.java @@ -0,0 +1,63 @@ +/****************************************************************************** + * Copyright (c) 2012 GitHub Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *****************************************************************************/ +package com.github.mobile.tests.gist; + +import android.net.Uri; +import android.test.AndroidTestCase; + +import com.github.mobile.core.gist.GistUriMatcher; + +import org.eclipse.egit.github.core.Gist; + +/** + * Unit tests of {@link GistUriMatcher} + */ +public class GistUriMatcherTest extends AndroidTestCase { + + /** + * Verify empty uri + */ + public void testEmptyUri() { + assertNull(GistUriMatcher.getGist(Uri.parse(""))); + } + + /** + * Verify invalid Gist ids in URIs + */ + public void testNonGistId() { + assertNull(GistUriMatcher.getGist(Uri + .parse("https://gist.github.com/TEST"))); + assertNull(GistUriMatcher.getGist(Uri + .parse("https://gist.github.com/abc%20"))); + assertNull(GistUriMatcher.getGist(Uri + .parse("https://gist.github.com/abcdefg"))); + } + + /** + * Verify public Gist id + */ + public void testPublicGist() { + Gist gist = GistUriMatcher.getGist(Uri + .parse("https://gist.github.com/1234")); + assertNotNull(gist); + assertEquals("1234", gist.getId()); + } + + /** + * Verify public Gist id + */ + public void testPrivateGist() { + Gist gist = GistUriMatcher.getGist(Uri + .parse("https://gist.github.com/abcd1234abcd1234abcd")); + assertNotNull(gist); + assertEquals("abcd1234abcd1234abcd", gist.getId()); + } +} From 5ef568ba80ed59f202f144603959ed6e03aefc15 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 3 Dec 2012 14:12:29 -0800 Subject: [PATCH 0112/1055] Add missing override annotation --- app/src/main/java/com/github/mobile/util/HttpImageGetter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java index 82e8ab5a7..63df78e8f 100644 --- a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java +++ b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java @@ -58,6 +58,7 @@ private LoadingImageGetter(final Context context, final int size) { image.setBounds(0, 0, imageSize, imageSize); } + @Override public Drawable getDrawable(String source) { return image; } From 35aad34ca889ce23f73eb43cd9447ad845106aa2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 3 Dec 2012 14:14:41 -0800 Subject: [PATCH 0113/1055] Use service helper for getting int pixels for size --- .../java/com/github/mobile/util/HttpImageGetter.java | 3 +-- .../java/com/github/mobile/util/ServiceUtils.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java index 63df78e8f..6e83c5b2e 100644 --- a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java +++ b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java @@ -51,8 +51,7 @@ private static class LoadingImageGetter implements ImageGetter { private final Drawable image; private LoadingImageGetter(final Context context, final int size) { - int imageSize = Math.round(context.getResources() - .getDisplayMetrics().density * size + 0.5F); + int imageSize = ServiceUtils.getIntPixels(context, size); image = context.getResources().getDrawable( drawable.image_loading_icon); image.setBounds(0, 0, imageSize, imageSize); diff --git a/app/src/main/java/com/github/mobile/util/ServiceUtils.java b/app/src/main/java/com/github/mobile/util/ServiceUtils.java index d7c913867..a11827f32 100644 --- a/app/src/main/java/com/github/mobile/util/ServiceUtils.java +++ b/app/src/main/java/com/github/mobile/util/ServiceUtils.java @@ -106,6 +106,17 @@ public static int getIntPixels(final View view, final int dp) { return getIntPixels(view.getResources(), dp); } + /** + * Get pixels from dps + * + * @param context + * @param dp + * @return pixels + */ + public static int getIntPixels(final Context context, final int dp) { + return getIntPixels(context.getResources(), dp); + } + /** * Get pixels from dps * From 14f8b31c6ed208aef21aec35f3afa794ad3e718e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 3 Dec 2012 14:16:15 -0800 Subject: [PATCH 0114/1055] Add missing override annotation --- app/src/main/java/com/github/mobile/util/HttpImageGetter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java index 6e83c5b2e..86a3f72be 100644 --- a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java +++ b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java @@ -198,6 +198,7 @@ private HttpRequest createRequest(String source) { return request; } + @Override public Drawable getDrawable(String source) { File output = null; try { From e9ff00a37014a4721f35f6fbb1bd1fb5f608d5b4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 3 Dec 2012 15:59:20 -0800 Subject: [PATCH 0115/1055] Load embedded images using contents API Previously repository paths embedded as images in comments, issues, etc. were requested by including username/password credentials in a standard HTTP request. This is no longer possible now that OAuth tokens are used in the app and these URLs do not accept authenticate using tokens. The contents API does support OAuth tokens and can be used to request embedded images that start with blob or raw in their paths. --- .../com/github/mobile/ServicesModule.java | 6 + .../ui/comment/RenderedCommentFragment.java | 11 +- .../ui/commit/CommitDiffListFragment.java | 5 +- .../github/mobile/ui/issue/IssueFragment.java | 5 +- .../github/mobile/util/HttpImageGetter.java | 103 ++++++++++++++---- .../com/github/mobile/util/ImageUtils.java | 71 ++++++++++-- 6 files changed, 157 insertions(+), 44 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ServicesModule.java b/app/src/main/java/com/github/mobile/ServicesModule.java index 1c312b679..1e84ccd5a 100644 --- a/app/src/main/java/com/github/mobile/ServicesModule.java +++ b/app/src/main/java/com/github/mobile/ServicesModule.java @@ -24,6 +24,7 @@ import org.eclipse.egit.github.core.client.GitHubClient; import org.eclipse.egit.github.core.service.CollaboratorService; import org.eclipse.egit.github.core.service.CommitService; +import org.eclipse.egit.github.core.service.ContentsService; import org.eclipse.egit.github.core.service.DataService; import org.eclipse.egit.github.core.service.EventService; import org.eclipse.egit.github.core.service.GistService; @@ -120,4 +121,9 @@ DataService dataService(GitHubClient client) { MarkdownService markdownService(GitHubClient client) { return new MarkdownService(client); } + + @Provides + ContentsService contentsService(GitHubClient client) { + return new ContentsService(client); + } } diff --git a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java index 74a7fe544..f83d2c41d 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java +++ b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java @@ -18,7 +18,6 @@ import android.os.Bundle; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.Loader; -import android.text.Html.ImageGetter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -34,6 +33,7 @@ import com.github.mobile.ui.MarkdownLoader; import com.github.mobile.util.HttpImageGetter; import com.github.mobile.util.ToastUtils; +import com.google.inject.Inject; import java.io.Serializable; @@ -53,13 +53,8 @@ public class RenderedCommentFragment extends DialogFragment implements private TextView bodyText; - private ImageGetter imageGetter; - - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - imageGetter = new HttpImageGetter(getActivity()); - } + @Inject + private HttpImageGetter imageGetter; @Override public void onViewCreated(View view, Bundle savedInstanceState) { diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java index fa8a5143f..f0dcb52f6 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java @@ -124,6 +124,7 @@ public class CommitDiffListFragment extends DialogFragment implements private HeaderFooterListAdapter adapter; + @Inject private HttpImageGetter commentImageGetter; @Override @@ -139,8 +140,6 @@ public void onCreate(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - commentImageGetter = new HttpImageGetter(getActivity()); - commit = store.getCommit(repository, base); ((TextView) loadingView.findViewById(id.tv_loading)) @@ -371,7 +370,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) { adapter = new HeaderFooterListAdapter(list, new CommitFileListAdapter(inflater, diffStyler, avatars, - new HttpImageGetter(getActivity()))); + commentImageGetter)); adapter.addFooter(inflater.inflate(layout.footer_separator, null)); list.setAdapter(adapter); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index 5217f800a..dc898056e 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -152,8 +152,10 @@ public class IssueFragment extends DialogFragment { private MenuItem stateItem; + @Inject private HttpImageGetter bodyImageGetter; + @Inject private HttpImageGetter commentImageGetter; @Override @@ -169,9 +171,6 @@ public void onCreate(Bundle savedInstanceState) { DialogFragmentActivity dialogActivity = (DialogFragmentActivity) getActivity(); - bodyImageGetter = new HttpImageGetter(dialogActivity); - commentImageGetter = new HttpImageGetter(dialogActivity); - milestoneTask = new EditMilestoneTask(dialogActivity, repositoryId, issueNumber) { diff --git a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java index 86a3f72be..a1742c2a4 100644 --- a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java +++ b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java @@ -15,31 +15,37 @@ */ package com.github.mobile.util; +import static android.util.Base64.DEFAULT; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static java.lang.Integer.MAX_VALUE; +import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_DEFAULT; import android.accounts.Account; -import android.accounts.AccountManager; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.net.Uri; import android.text.Html.ImageGetter; import android.text.TextUtils; +import android.util.Base64; import android.widget.TextView; import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; import com.github.mobile.R.drawable; -import com.github.mobile.accounts.AccountUtils; +import com.github.mobile.accounts.AuthenticatedUserTask; import com.google.inject.Inject; import java.io.File; import java.io.IOException; import java.util.HashMap; +import java.util.List; import java.util.Map; -import roboguice.util.RoboAsyncTask; +import org.eclipse.egit.github.core.RepositoryContents; +import org.eclipse.egit.github.core.RepositoryId; +import org.eclipse.egit.github.core.service.ContentsService; /** * Getter for an image @@ -79,14 +85,18 @@ private static boolean containsImages(final String html) { private final Map fullHtmlCache = new HashMap(); + private final ContentsService service; + /** * Create image getter for context * * @param context + * @param service */ @Inject - public HttpImageGetter(Context context) { + public HttpImageGetter(Context context, ContentsService service) { this.context = context; + this.service = service; dir = context.getCacheDir(); width = ServiceUtils.getDisplayWidth(context); loading = new LoadingImageGetter(context, 24); @@ -165,10 +175,10 @@ public HttpImageGetter bind(final TextView view, final String html, show(view, encoded); view.setTag(id); - new RoboAsyncTask(context) { + new AuthenticatedUserTask(context) { @Override - public CharSequence call() throws Exception { + protected CharSequence run(Account account) throws Exception { return HtmlUtils.encode(html, HttpImageGetter.this); } @@ -184,26 +194,79 @@ protected void onSuccess(final CharSequence html) throws Exception { return this; } - private HttpRequest createRequest(String source) { - HttpRequest request = HttpRequest.get(source); - if (HttpRequestUtils.isSecure(request)) { - Account account = AccountUtils.getAccount(context); - if (account != null) { - String password = AccountManager.get(context).getPassword( - account); - if (!TextUtils.isEmpty(password)) - request.basic(account.name, password); - } - } - return request; + /** + * Request an image using the contents API if the source URI is a path to a + * file already in the repository + * + * @param source + * @return + * @throws IOException + */ + private Drawable requestRepositoryImage(final String source) + throws IOException { + if (TextUtils.isEmpty(source)) + return null; + + Uri uri = Uri.parse(source); + if (!HOST_DEFAULT.equals(uri.getHost())) + return null; + + List segments = uri.getPathSegments(); + if (segments.size() < 5) + return null; + + String prefix = segments.get(2); + // Two types of urls supported: + // github.com/github/android/raw/master/app/res/drawable-xhdpi/app_icon.png + // github.com/github/android/blob/master/app/res/drawable-xhdpi/app_icon.png?raw=true + if (!("raw".equals(prefix) || ("blob".equals(prefix) && !TextUtils + .isEmpty(uri.getQueryParameter("raw"))))) + return null; + + String owner = segments.get(0); + if (TextUtils.isEmpty(owner)) + return null; + String name = segments.get(1); + if (TextUtils.isEmpty(name)) + return null; + String branch = segments.get(3); + if (TextUtils.isEmpty(branch)) + return null; + + StringBuilder path = new StringBuilder(segments.get(4)); + for (int i = 5; i < segments.size(); i++) + path.append('/').append(segments.get(i)); + + List contents = service.getContents( + RepositoryId.create(owner, name), path.toString(), branch); + if (contents != null && contents.size() == 1) { + byte[] content = Base64.decode(contents.get(0).getContent(), + DEFAULT); + Bitmap bitmap = ImageUtils.getBitmap(content, width, MAX_VALUE); + if (bitmap == null) + return loading.getDrawable(source); + BitmapDrawable drawable = new BitmapDrawable( + context.getResources(), bitmap); + drawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight()); + return drawable; + } else + return null; } @Override - public Drawable getDrawable(String source) { + public Drawable getDrawable(final String source) { + try { + Drawable repositoryImage = requestRepositoryImage(source); + if (repositoryImage != null) + return repositoryImage; + } catch (Exception e) { + // Ignore and attempt request over regular HTTP request + } + File output = null; try { output = File.createTempFile("image", ".jpg", dir); - HttpRequest request = createRequest(source); + HttpRequest request = HttpRequest.get(source); if (!request.ok()) throw new IOException("Unexpected response code: " + request.code()); diff --git a/app/src/main/java/com/github/mobile/util/ImageUtils.java b/app/src/main/java/com/github/mobile/util/ImageUtils.java index 1c214bca9..3401b43d0 100644 --- a/app/src/main/java/com/github/mobile/util/ImageUtils.java +++ b/app/src/main/java/com/github/mobile/util/ImageUtils.java @@ -80,6 +80,41 @@ public static Bitmap getBitmap(final String imagePath, int sampleSize) { } } + /** + * Get a bitmap from the image + * + * @param image + * @param sampleSize + * @return bitmap or null if read fails + */ + public static Bitmap getBitmap(final byte[] image, int sampleSize) { + final Options options = new Options(); + options.inDither = false; + options.inSampleSize = sampleSize; + return BitmapFactory.decodeByteArray(image, 0, image.length, options); + } + + /** + * Get scale for image of size and max height/width + * + * @param size + * @param width + * @param height + * @return scale + */ + public static int getScale(Point size, int width, int height) { + int currWidth = size.x; + int currHeight = size.y; + + int scale = 1; + while (currWidth >= width || currHeight >= height) { + currWidth /= 2; + currHeight /= 2; + scale *= 2; + } + return scale; + } + /** * Get size of image * @@ -108,6 +143,19 @@ public static Point getSize(final String imagePath) { } } + /** + * Get size of image + * + * @param image + * @return size + */ + public static Point getSize(final byte[] image) { + final Options options = new Options(); + options.inJustDecodeBounds = true; + BitmapFactory.decodeByteArray(image, 0, image.length, options); + return new Point(options.outWidth, options.outHeight); + } + /** * Get bitmap with maximum height or width * @@ -118,17 +166,20 @@ public static Point getSize(final String imagePath) { */ public static Bitmap getBitmap(final String imagePath, int width, int height) { Point size = getSize(imagePath); - int currWidth = size.x; - int currHeight = size.y; - - int scale = 1; - while (currWidth >= width || currHeight >= height) { - currWidth /= 2; - currHeight /= 2; - scale *= 2; - } + return getBitmap(imagePath, getScale(size, width, height)); + } - return getBitmap(imagePath, scale); + /** + * Get bitmap with maximum height or width + * + * @param image + * @param width + * @param height + * @return image + */ + public static Bitmap getBitmap(final byte[] image, int width, int height) { + Point size = getSize(image); + return getBitmap(image, getScale(size, width, height)); } /** From b04da3f4a2749e9a204a6c836de112c0cc8b3b7d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 3 Dec 2012 16:18:47 -0800 Subject: [PATCH 0116/1055] Upgrade to GitHub Java API 2.1.2 --- app/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pom.xml b/app/pom.xml index a466cf80d..be8ddc18a 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -75,7 +75,7 @@ org.eclipse.mylyn.github org.eclipse.egit.github.core - 2.1.0 + 2.1.2 com.github.kevinsawicki From b04a9e7036bba11f6df0f33c267681f273602695 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 4 Dec 2012 08:10:02 -0800 Subject: [PATCH 0117/1055] Remove unused HttpRequestUtils class --- .../github/mobile/util/HttpRequestUtils.java | 43 ------------------ .../tests/util/HttpRequestUtilsTest.java | 44 ------------------- 2 files changed, 87 deletions(-) delete mode 100644 app/src/main/java/com/github/mobile/util/HttpRequestUtils.java delete mode 100644 integration-tests/src/main/java/com/github/mobile/tests/util/HttpRequestUtilsTest.java diff --git a/app/src/main/java/com/github/mobile/util/HttpRequestUtils.java b/app/src/main/java/com/github/mobile/util/HttpRequestUtils.java deleted file mode 100644 index 4abad4e85..000000000 --- a/app/src/main/java/com/github/mobile/util/HttpRequestUtils.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2012 GitHub Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.github.mobile.util; - -import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_DEFAULT; - -import com.github.kevinsawicki.http.HttpRequest; - -import java.net.HttpURLConnection; - -import javax.net.ssl.HttpsURLConnection; - -/** - * Utilities for working with {@link HttpRequest} objects - */ -public class HttpRequestUtils { - - /** - * Is the given request to a URL that can have github.com credentials - * included with the request? - * - * @param request - * @return true if secure, false otherwise - */ - public static boolean isSecure(final HttpRequest request) { - final HttpURLConnection connection = request.getConnection(); - return connection instanceof HttpsURLConnection - && HOST_DEFAULT.equals(connection.getURL().getHost()); - } -} diff --git a/integration-tests/src/main/java/com/github/mobile/tests/util/HttpRequestUtilsTest.java b/integration-tests/src/main/java/com/github/mobile/tests/util/HttpRequestUtilsTest.java deleted file mode 100644 index 3d161c11d..000000000 --- a/integration-tests/src/main/java/com/github/mobile/tests/util/HttpRequestUtilsTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012 GitHub Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.github.mobile.tests.util; - -import android.test.AndroidTestCase; - -import com.github.kevinsawicki.http.HttpRequest; -import com.github.mobile.util.HttpRequestUtils; - -/** - * Unit tests of {@link HttpRequestUtils} - */ -public class HttpRequestUtilsTest extends AndroidTestCase { - - /** - * Test secure requests - */ - public void testSecureRequests() { - HttpRequestUtils.isSecure(HttpRequest.get("https://github.com")); - HttpRequestUtils.isSecure(HttpRequest - .get("https://github.com/a/b/raw/1234")); - } - - /** - * Test insecure requests - */ - public void testInsecureRequests() { - HttpRequestUtils.isSecure(HttpRequest.get("http://github.com")); - HttpRequestUtils.isSecure(HttpRequest.get("https://github.c0m")); - } -} From 7bdbe369302a6ab05261ef656ac7583c5c70089d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 4 Dec 2012 09:10:27 -0800 Subject: [PATCH 0118/1055] Set fadingEdge to none in ListView style --- app/res/values/styles.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/res/values/styles.xml b/app/res/values/styles.xml index 5cb92cb83..983e54b74 100644 --- a/app/res/values/styles.xml +++ b/app/res/values/styles.xml @@ -45,6 +45,7 @@ 2dp @drawable/list_divider @android:color/transparent + none + + \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java b/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java index c15fe4085..c3758cfe1 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java @@ -17,6 +17,7 @@ import android.os.Bundle; +import com.actionbarsherlock.view.Window; import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockFragmentActivity; @@ -35,6 +36,7 @@ public abstract class DialogFragmentActivity extends @Override protected void onCreate(Bundle savedInstanceState) { + requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); finder = new ViewFinder(this); diff --git a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java b/app/src/main/java/com/github/mobile/ui/ItemListFragment.java index 271538126..622a6fe71 100644 --- a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/ItemListFragment.java @@ -189,6 +189,7 @@ private void refresh(final Bundle args) { if (!isUsable()) return; + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true); getLoaderManager().restartLoader(0, args, this); } @@ -211,6 +212,8 @@ public void onLoadFinished(Loader> loader, List items) { this.items = items; getListAdapter().getWrappedAdapter().setItems(items.toArray()); showList(); + + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); } /** diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java index f0dcb52f6..5c6e3d19c 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java @@ -219,6 +219,8 @@ private void shareCommit() { } private void refreshCommit() { + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true); + new RefreshCommitTask(getActivity(), repository, base, commentImageGetter) { @@ -238,6 +240,7 @@ protected void onSuccess(FullCommit commit) throws Exception { super.onSuccess(commit); updateList(commit.getCommit(), commit, commit.getFiles()); + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); } @Override @@ -246,6 +249,8 @@ protected void onException(Exception e) throws RuntimeException { ToastUtils.show(getActivity(), e, string.error_commit_load); ViewUtils.setGone(progress, true); + + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); } }.execute(); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java index 4d9325b80..49470e8a2 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java @@ -380,12 +380,15 @@ private void updateList(Gist gist, List comments) { } private void refreshGist() { + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true); + new RefreshGistTask(getActivity(), gistId, imageGetter) { @Override protected void onException(Exception e) throws RuntimeException { super.onException(e); + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); ToastUtils.show(getActivity(), e, string.error_gist_load); } @@ -407,6 +410,8 @@ protected void onSuccess(FullGist fullGist) throws Exception { gist = fullGist.getGist(); comments = fullGist; updateList(fullGist.getGist(), fullGist); + + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); } }.execute(); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index dc898056e..2fc6cd2ea 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -400,6 +400,8 @@ private void updateHeader(final Issue issue) { } private void refreshIssue() { + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true); + new RefreshIssueTask(getActivity(), repositoryId, issueNumber, bodyImageGetter, commentImageGetter) { @@ -409,6 +411,8 @@ protected void onException(Exception e) throws RuntimeException { ToastUtils.show(getActivity(), e, string.error_issue_load); ViewUtils.setGone(progress, true); + + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); } @Override @@ -421,6 +425,8 @@ protected void onSuccess(FullIssue fullIssue) throws Exception { issue = fullIssue.getIssue(); comments = fullIssue; updateList(fullIssue.getIssue(), fullIssue); + + getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); } }.execute(); From de3e20e0b593f28868e68f55394ec5ad526b0483 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Jan 2013 09:36:56 -0800 Subject: [PATCH 0142/1055] Use static import for Window constant --- .../java/com/github/mobile/ui/DialogFragmentActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java b/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java index c3758cfe1..7e4bb8144 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java @@ -15,9 +15,9 @@ */ package com.github.mobile.ui; +import static com.actionbarsherlock.view.Window.FEATURE_INDETERMINATE_PROGRESS; import android.os.Bundle; -import com.actionbarsherlock.view.Window; import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockFragmentActivity; @@ -36,7 +36,8 @@ public abstract class DialogFragmentActivity extends @Override protected void onCreate(Bundle savedInstanceState) { - requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); + requestWindowFeature(FEATURE_INDETERMINATE_PROGRESS); + super.onCreate(savedInstanceState); finder = new ViewFinder(this); From ed8696b69da298d771b0126b478a6d0e93501b80 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Jan 2013 09:45:56 -0800 Subject: [PATCH 0143/1055] Use standard refresh icon for action bar spinner --- app/res/drawable-hdpi/action_refresh.png | Bin 0 -> 1138 bytes app/res/drawable-mdpi/action_refresh.png | Bin 0 -> 748 bytes app/res/drawable-xhdpi/action_refresh.png | Bin 0 -> 1513 bytes app/res/drawable/actionbar_spinner.xml | 29 ++++++++++++++++++++++ app/res/values/theme.xml | 5 ++-- 5 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 app/res/drawable-hdpi/action_refresh.png create mode 100644 app/res/drawable-mdpi/action_refresh.png create mode 100644 app/res/drawable-xhdpi/action_refresh.png create mode 100644 app/res/drawable/actionbar_spinner.xml diff --git a/app/res/drawable-hdpi/action_refresh.png b/app/res/drawable-hdpi/action_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..3671f9ed478913f11256de5f6ae26b04001052ee GIT binary patch literal 1138 zcmV-&1daQNP)|M)g_StLiIeU&%v+C=dS?9n0-}kMx_F8+biM31f5=(Ra?b-~a zdIZ}>Aekf3)YQ~D7K?oilJmbA0mSz~co7EHrPKgI)G0&35YP)`g74rJc#6Q6@d9bn zle&W-o8Kq5x&cS@B#37M2^ioZqDdyeEl`EndfIk!#7}VA%%J|gt%(*-Aq32VEDsE~ zB{kyeoY9eax8!1=(Kc6T0|*}o$qq2Zmdr9P4+HlsW5aD^h#wEZKG3%rq94>f1ohyB z)5Bf(90bOJ(V#;Dfdv@28kqsatH%!ji871k_DOIF0Ux~t&|aqXz{*H-Wk2oDL}CE) zQ6w${-3eD^?78I{;@#ug z8RV}3I^byYd;sUlmKZosFotVgot=-2@#Sp1PJA$RNSbC`FsO8G-)%U2W9W z!oM-}2(*@Pmj?qA`F_;kt;9e{IvH4lSaZ&oV4yOc44g%5mLYgC1{%`B0Mkbo0!Iw7 z4TxWyXd3%2qpkG}AYQ9aImk9ReNShB4M3zD2ptQx%<1(y{!>CagLj~i9@M$mw~#k} z?!TtdeA<6W>IgujbAgVQiHi1&b&x;uRZajowK?tr=3##??e#n)EMZ3AFc}kFrRa>j z7V`Uk86JN{Uo5-Pyu%sK%vC!*vLgF=TZuk)+T(@_6)14C++sNOm$)T%A z-x6j7v@0(4$b5(TV#uF+F(W*S-{t|G@XXr{HPOAP&e@*rxFPE80^vZG4=Vj551csjDfi{F7h2)`vARXod%_d|7_pvZ)6w)I^5`xyszo zHmD9V*S*|@G2p)L>Rh}N5$ef*3TApxp?`4n2HNO!-}46OJn_j(OqlvG2Gp~A9Pzqh zNofgeKx%dDYt2JWq8-^N!+Ky@d9DF6Tf07*qoM6N<$ Ef~J`n%m4rY literal 0 HcmV?d00001 diff --git a/app/res/drawable-mdpi/action_refresh.png b/app/res/drawable-mdpi/action_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..00a4cb4d3a9b9797d137a8bd15fa6affff49a6d5 GIT binary patch literal 748 zcmVglAbBZ?I}vdCuL^*8JA^f0D_9GZXbQXnL*N0J1YKY^s7Az(AQ7=E zK;kM$E`kja8}}#kFTp0quO0y(6AK{m5`vq-ao`G`7{8~!@*&7oXz9%$qnCl=Wld}K_ zD+#&-O29kN0MVy_V9r-cR4=ra0=3_ zpOnPn)W$mp^sG&H6yMRL0(uDC=?T{5q!#+3 z)T={k8PtGQ0bMvNJbtQDE6Jam-rOCFBS2?ZCDnDTFB^TDh1m>~_dqYnRe?~8Bj6Ye z=Rq@sLzH?w&uUiNKn2jr_~KM!nBPbEO-Cipr2@4$&q3NBmoyi@I29nbrHxk*ixg0h etRB+;0)7LdDBK~CcCPsV0000EQN_#>&v1V@pg6~J*(-B~N!wEp}ClK^}a0CKe zQ4<0{x)((IgY&={;6%_HbO#5(ZmM;kR3Vtc#B;jdt?$ ztwh8N4SS;zKqJPhL>GYI&xgrWpwF%-6A|DmUq{gdNP2x7M1*d>ggn|kf&jWryh;=S z2)-xYp9GiZu=tDXYr!Va3U+~g;4p9u(Cuf(6iG1kcZbffX2N zrd|gYfmM)|2vrLThE6gXxxyR^nrlW!(?>li>wvShx2c3L`X&iFg|EPvN;Jw5(0{@;f`%{Sh~c?3XK6V4rmM-dzanXTST z3To&iK=OQE4%cH1zKaQdc0n-&xpfub0=#J-o-Ug8Z$W_8ASMMhb`@X(Jhj$O7j0GV zD~NxvTUP-z!(U{0eHsDY31(7|0c!!O-2WQ>-xtI`*sY5IN=1ESc+|pYNJvU5ID$X} zE&?bGWo|on5d5$}4#CYCohM;LImRP_cBe|6eQh%_y9l5?`aFZ}&p1))tI&b~Ga)eC zATa}O=7{aUvt9&vg2=AxYyq_K83c3^v$qUX{;kmN$2lY5B|a`Ocua%ar+M70M?jvT zBCjKW_9kZ;9L6HRhCE(1FF>+2*YaF>#dOgQQR(!mr5*%O4naA|blFAl*W?AS>-8Xj z5~m}LU_V2EDRnPEa^9#%oq6Oo3jyA11Oc*=r%IfRL;$Pv!kWDW=>6jfbRjTv6HaOJ zU;&a@xCcba&}?k;T_bcMJ=Ng|+-B(FS0_>CGF<7gG1&aZ#zvG$u);Gq&%cr=Qy{uB zuVU79d}{gqP{y?t*t9)QXm1{41n9h8D@5C(9pr3?zH8ecU60@|ko-!TLji_v>5f_k0c^=^-Kp~uDVYH&9=vqHl){687ne_9((Rg57( zr3op`N0Xj{{}`gb<`E@uEo`m=Hv(m%E0u4#Fd<||8bbh0N-yLEmAd{T-_tKhXyKxJ zS}#bP0`!8!*~x#^%xbIqnD1k>Y&eDhdiCuM2LVE>YBXs9G$%$bGKK&;D||mRD$Dj8 zsi!o&^+G4lZVUnR0^}zky&wNUJp?pA=sm$uKds3qTOOm=)1rhDYq!OurMI+{l~wr; z=+(9MWCYhv=R@m+D}k~$IsvvR+o`k)EW_4%n+860VhNyhxzgs^fsKRkwk$G;aT@>Y z{lUKAWS|!<^o-Z)P`SqPtFl}8zBzVpXK{)pfEG9EUG=ZM(C1k_7U`o_^50lv!BOS}I7hH0=+c#XtF P00000NkvXXu0mjfE%(C( literal 0 HcmV?d00001 diff --git a/app/res/drawable/actionbar_spinner.xml b/app/res/drawable/actionbar_spinner.xml new file mode 100644 index 000000000..99ee8e703 --- /dev/null +++ b/app/res/drawable/actionbar_spinner.xml @@ -0,0 +1,29 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/res/values/theme.xml b/app/res/values/theme.xml index 036c74052..4e3f991b6 100644 --- a/app/res/values/theme.xml +++ b/app/res/values/theme.xml @@ -30,9 +30,8 @@ \ No newline at end of file From ae0744311dfd2e48206ff5b327847c1c1b489a56 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Jan 2013 09:58:09 -0800 Subject: [PATCH 0144/1055] Add missing override annotation --- .../main/java/com/github/mobile/ui/issue/IssuesViewActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java index b152b705e..99abb9c2f 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java @@ -278,6 +278,7 @@ public void startActivity(Intent intent) { super.startActivity(intent); } + @Override protected FragmentProvider getProvider() { return adapter; } From 8ccee488b6b677edfc79634462fb582124bd0397 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Jan 2013 10:12:40 -0800 Subject: [PATCH 0145/1055] Support navigating up from IssuesViewActivity Closes #301 --- .../mobile/ui/issue/IssuesViewActivity.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java index 99abb9c2f..91e16d570 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java @@ -15,6 +15,8 @@ */ package com.github.mobile.ui.issue; +import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; +import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; import static com.github.mobile.Intents.EXTRA_ISSUE_NUMBERS; import static com.github.mobile.Intents.EXTRA_POSITION; import static com.github.mobile.Intents.EXTRA_REPOSITORIES; @@ -23,6 +25,7 @@ import android.os.Bundle; import com.actionbarsherlock.app.ActionBar; +import com.actionbarsherlock.view.MenuItem; import com.github.mobile.Intents.Builder; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -34,6 +37,7 @@ import com.github.mobile.ui.PagerActivity; import com.github.mobile.ui.UrlLauncher; import com.github.mobile.ui.ViewPager; +import com.github.mobile.ui.repo.RepositoryViewActivity; import com.github.mobile.util.AvatarLoader; import com.google.inject.Inject; @@ -172,6 +176,7 @@ public static Intent createIntent(Collection issues, protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); issueNumbers = getIntArrayExtra(EXTRA_ISSUE_NUMBERS); pullRequests = getBooleanArrayExtra(EXTRA_PULL_REQUESTS); repoIds = getSerializableExtra(EXTRA_REPOSITORIES); @@ -282,4 +287,31 @@ public void startActivity(Intent intent) { protected FragmentProvider getProvider() { return adapter; } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + Repository repository = repo; + if (repository == null) { + int position = pager.getCurrentItem(); + RepositoryId repoId = repoIds.get(position); + if (repoId != null) { + RepositoryIssue issue = store.getIssue(repoId, + issueNumbers[position]); + if (issue != null) + repository = issue.getRepository(); + } + } + if (repository != null) { + Intent intent = RepositoryViewActivity.createIntent(repository); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP + | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + } + return true; + default: + return super.onOptionsItemSelected(item); + } + } } From c318a9fab67b00c0b9fac4d87c0276291c250c5b Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Sun, 9 Dec 2012 16:20:22 +0200 Subject: [PATCH 0146/1055] Add long click support to news feed Closes #279 --- app/res/values/strings.xml | 1 + .../github/mobile/ui/ItemListFragment.java | 22 ++++++++++ .../github/mobile/ui/LightAlertDialog.java | 27 ++++++++++++ .../com/github/mobile/ui/NewsFragment.java | 41 +++++++++++++++++++ 4 files changed, 91 insertions(+) diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index d00cdcaf6..0a25acbbc 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -233,6 +233,7 @@ Unfollowing… Starring… Unstarring… + Navigate to… repositories diff --git a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java b/app/src/main/java/com/github/mobile/ui/ItemListFragment.java index 622a6fe71..a76dcdfa1 100644 --- a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/ItemListFragment.java @@ -25,6 +25,7 @@ import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; +import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.ProgressBar; @@ -133,6 +134,14 @@ public void onItemClick(AdapterView parent, View view, onListItemClick((ListView) parent, view, position, id); } }); + listView.setOnItemLongClickListener(new OnItemLongClickListener() { + + @Override + public boolean onItemLongClick(AdapterView parent, View view, + int position, long id) { + return onListItemLongClick((ListView) parent, view, position, id); + } + }); progressBar = (ProgressBar) view.findViewById(id.pb_loading); emptyView = (TextView) view.findViewById(android.R.id.empty); @@ -433,4 +442,17 @@ protected ItemListFragment setEmptyText(final int resId) { */ public void onListItemClick(ListView l, View v, int position, long id) { } + + /** + * Callback when a list view item is clicked and held + * + * @param l + * @param v + * @param position + * @param id + * @return true if the callback consumed the long click, false otherwise + */ + public boolean onListItemLongClick(ListView l, View v, int position, long id) { + return false; + } } diff --git a/app/src/main/java/com/github/mobile/ui/LightAlertDialog.java b/app/src/main/java/com/github/mobile/ui/LightAlertDialog.java index ce431428c..1ffe0434f 100644 --- a/app/src/main/java/com/github/mobile/ui/LightAlertDialog.java +++ b/app/src/main/java/com/github/mobile/ui/LightAlertDialog.java @@ -45,4 +45,31 @@ private LightAlertDialog(final Context context, final int theme) { private LightAlertDialog(final Context context) { super(context); } + + /** + * Alert dialog builder using the Holo Light theme + */ + public static class Builder extends AlertDialog.Builder { + + /** + * Create alert dialog builder + * + * @param context + * @return dialog builder + */ + public static LightAlertDialog.Builder create(final Context context) { + if (SDK_INT >= ICE_CREAM_SANDWICH) + return new LightAlertDialog.Builder(context, THEME_HOLO_LIGHT); + else + return new LightAlertDialog.Builder(context); + } + + private Builder(Context context) { + super(context); + } + + private Builder(Context context, int theme) { + super(context, theme); + } + } } diff --git a/app/src/main/java/com/github/mobile/ui/NewsFragment.java b/app/src/main/java/com/github/mobile/ui/NewsFragment.java index b6cc79e99..6e8cd3ea2 100644 --- a/app/src/main/java/com/github/mobile/ui/NewsFragment.java +++ b/app/src/main/java/com/github/mobile/ui/NewsFragment.java @@ -20,6 +20,8 @@ import static org.eclipse.egit.github.core.event.Event.TYPE_COMMIT_COMMENT; import static org.eclipse.egit.github.core.event.Event.TYPE_DOWNLOAD; import static org.eclipse.egit.github.core.event.Event.TYPE_PUSH; +import android.content.DialogInterface; +import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.net.Uri; import android.os.Bundle; @@ -40,6 +42,7 @@ import com.github.mobile.ui.issue.IssuesViewActivity; import com.github.mobile.ui.repo.RepositoryViewActivity; import com.github.mobile.ui.user.NewsListAdapter; +import com.github.mobile.ui.user.UserViewActivity; import com.github.mobile.util.AvatarLoader; import com.google.inject.Inject; @@ -141,6 +144,44 @@ public void onListItemClick(ListView l, View v, int position, long id) { viewUser(users); } + @Override + public boolean onListItemLongClick(ListView l, View v, int position, long id) { + if (!isUsable()) + return false; + + final Event event = (Event) l.getItemAtPosition(position); + final Repository repo = RepositoryEventMatcher.getRepository( + event.getRepo(), event.getActor(), event.getOrg()); + final User user = event.getActor(); + + if (repo != null && user != null) { + final CharSequence[] items = { user.getLogin(), + event.getRepo().getName() }; + + final LightAlertDialog.Builder builder = LightAlertDialog.Builder + .create(getActivity()); + builder.setTitle(string.navigate_to); + builder.setItems(items, new OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case 0: + startActivity(UserViewActivity.createIntent(user)); + break; + case 1: + viewRepository(repo); + break; + } + } + }); + builder.create().show(); + + return true; + } + + return false; + } + private void openDownload(Event event) { Download download = ((DownloadPayload) event.getPayload()) .getDownload(); From 0b667e2d92322ae948c833a783abbba123754211 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Jan 2013 10:31:53 -0800 Subject: [PATCH 0147/1055] Don't open new activity when viewing yourself --- .../java/com/github/mobile/ui/NewsFragment.java | 13 +++++++++++-- .../github/mobile/ui/user/UserNewsFragment.java | 15 +++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/NewsFragment.java b/app/src/main/java/com/github/mobile/ui/NewsFragment.java index 6e8cd3ea2..9e60cbcee 100644 --- a/app/src/main/java/com/github/mobile/ui/NewsFragment.java +++ b/app/src/main/java/com/github/mobile/ui/NewsFragment.java @@ -42,7 +42,6 @@ import com.github.mobile.ui.issue.IssuesViewActivity; import com.github.mobile.ui.repo.RepositoryViewActivity; import com.github.mobile.ui.user.NewsListAdapter; -import com.github.mobile.ui.user.UserViewActivity; import com.github.mobile.util.AvatarLoader; import com.google.inject.Inject; @@ -166,7 +165,7 @@ public boolean onListItemLongClick(ListView l, View v, int position, long id) { public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: - startActivity(UserViewActivity.createIntent(user)); + viewUser(user); break; case 1: viewRepository(repo); @@ -258,6 +257,16 @@ protected void viewRepository(Repository repository) { protected void viewUser(UserPair users) { } + /** + * Start an activity to view the given {@link User} + * + * @param user + * @return true if new activity started, false otherwise + */ + protected boolean viewUser(User user) { + return false; + } + /** * Start an activity to view the given {@link Issue} * diff --git a/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java b/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java index d6c778a20..51054f6b3 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java +++ b/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java @@ -79,11 +79,18 @@ public void onOrganizationSelected(User organization) { refreshWithProgress(); } + @Override + protected boolean viewUser(User user) { + if (org.getId() != user.getId()) { + startActivity(UserViewActivity.createIntent(user)); + return true; + } + return false; + } + @Override protected void viewUser(UserPair users) { - if (org.getId() != users.from.getId()) - startActivity(UserViewActivity.createIntent(users.from)); - else if (org.getId() != users.to.getId()) - startActivity(UserViewActivity.createIntent(users.to)); + if (!viewUser(users.from)) + viewUser(users.to); } } From 3e16ab426c830d316d54229b020bf6026f152e3f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Jan 2013 11:38:26 -0800 Subject: [PATCH 0148/1055] Use a ViewFinder in CommitDiffListFragment --- .../ui/commit/CommitDiffListFragment.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java index 5c6e3d19c..f87acf666 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java @@ -42,6 +42,7 @@ import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; +import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.R.id; import com.github.mobile.R.layout; @@ -219,7 +220,8 @@ private void shareCommit() { } private void refreshCommit() { - getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true); + getSherlockActivity() + .setSupportProgressBarIndeterminateVisibility(true); new RefreshCommitTask(getActivity(), repository, base, commentImageGetter) { @@ -240,7 +242,8 @@ protected void onSuccess(FullCommit commit) throws Exception { super.onSuccess(commit); updateList(commit.getCommit(), commit, commit.getFiles()); - getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); + getSherlockActivity() + .setSupportProgressBarIndeterminateVisibility(false); } @Override @@ -250,7 +253,8 @@ protected void onException(Exception e) throws RuntimeException { ToastUtils.show(getActivity(), e, string.error_commit_load); ViewUtils.setGone(progress, true); - getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); + getSherlockActivity() + .setSupportProgressBarIndeterminateVisibility(false); } }.execute(); @@ -411,26 +415,25 @@ private void showFileOptions(CharSequence line, final int position, View view = getActivity().getLayoutInflater().inflate( layout.diff_line_dialog, null); + ViewFinder finder = new ViewFinder(view); - TextView diff = (TextView) view.findViewById(id.tv_diff); + TextView diff = finder.textView(id.tv_diff); diff.setText(line); diffStyler.updateColors(line, diff); - TextView commitText = (TextView) view.findViewById(id.tv_commit); - commitText.setText(getString(string.commit_prefix) + finder.setText(id.tv_commit, getString(string.commit_prefix) + CommitUtils.abbreviate(commit)); - view.findViewById(id.ll_view_area).setOnClickListener( - new OnClickListener() { + finder.find(id.ll_view_area).setOnClickListener(new OnClickListener() { - public void onClick(View v) { - dialog.dismiss(); + public void onClick(View v) { + dialog.dismiss(); - openFile(file); - } - }); + openFile(file); + } + }); - view.findViewById(id.ll_comment_area).setOnClickListener( + finder.find(id.ll_comment_area).setOnClickListener( new OnClickListener() { public void onClick(View v) { From fb1f94df860d80d099596aa61b9db865455ce385 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 21 Jan 2013 11:43:38 -0800 Subject: [PATCH 0149/1055] Show avatars in navigate to dialog --- app/res/layout/nav_dialog.xml | 79 +++++++++++++++++++ .../com/github/mobile/ui/NewsFragment.java | 55 ++++++++----- 2 files changed, 113 insertions(+), 21 deletions(-) create mode 100644 app/res/layout/nav_dialog.xml diff --git a/app/res/layout/nav_dialog.xml b/app/res/layout/nav_dialog.xml new file mode 100644 index 000000000..e7bc837b1 --- /dev/null +++ b/app/res/layout/nav_dialog.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/ui/NewsFragment.java b/app/src/main/java/com/github/mobile/ui/NewsFragment.java index 9e60cbcee..0b9720f53 100644 --- a/app/src/main/java/com/github/mobile/ui/NewsFragment.java +++ b/app/src/main/java/com/github/mobile/ui/NewsFragment.java @@ -20,16 +20,19 @@ import static org.eclipse.egit.github.core.event.Event.TYPE_COMMIT_COMMENT; import static org.eclipse.egit.github.core.event.Event.TYPE_DOWNLOAD; import static org.eclipse.egit.github.core.event.Event.TYPE_PUSH; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; +import android.app.AlertDialog; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.view.View; +import android.view.View.OnClickListener; import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; +import com.github.kevinsawicki.wishlist.ViewFinder; +import com.github.mobile.R.id; +import com.github.mobile.R.layout; import com.github.mobile.R.string; import com.github.mobile.core.gist.GistEventMatcher; import com.github.mobile.core.issue.IssueEventMatcher; @@ -144,7 +147,8 @@ public void onListItemClick(ListView l, View v, int position, long id) { } @Override - public boolean onListItemLongClick(ListView l, View v, int position, long id) { + public boolean onListItemLongClick(ListView l, View v, int position, + long itemId) { if (!isUsable()) return false; @@ -154,26 +158,35 @@ public boolean onListItemLongClick(ListView l, View v, int position, long id) { final User user = event.getActor(); if (repo != null && user != null) { - final CharSequence[] items = { user.getLogin(), - event.getRepo().getName() }; - - final LightAlertDialog.Builder builder = LightAlertDialog.Builder - .create(getActivity()); - builder.setTitle(string.navigate_to); - builder.setItems(items, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - switch (which) { - case 0: - viewUser(user); - break; - case 1: - viewRepository(repo); - break; - } + final AlertDialog dialog = LightAlertDialog.create(getActivity()); + dialog.setTitle(string.navigate_to); + dialog.setCanceledOnTouchOutside(true); + + View view = getActivity().getLayoutInflater().inflate( + layout.nav_dialog, null); + ViewFinder finder = new ViewFinder(view); + avatars.bind(finder.imageView(id.iv_user_avatar), user); + avatars.bind(finder.imageView(id.iv_repo_avatar), repo.getOwner()); + finder.setText(id.tv_login, user.getLogin()); + finder.setText(id.tv_repo_name, repo.generateId()); + finder.onClick(id.ll_user_area, new OnClickListener() { + + public void onClick(View v) { + dialog.dismiss(); + + viewUser(user); } }); - builder.create().show(); + finder.onClick(id.ll_repo_area, new OnClickListener() { + + public void onClick(View v) { + dialog.dismiss(); + + viewRepository(repo); + } + }); + dialog.setView(view); + dialog.show(); return true; } From 4cb5b4c0e0188e3b8a95e54b945912853f6a701e Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Sun, 20 Jan 2013 03:15:47 +0200 Subject: [PATCH 0150/1055] Support zooming out when viewing code Closes #281 Closes #311 --- app/src/main/java/com/github/mobile/util/SourceEditor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/github/mobile/util/SourceEditor.java b/app/src/main/java/com/github/mobile/util/SourceEditor.java index 5481789c6..202a1cd00 100644 --- a/app/src/main/java/com/github/mobile/util/SourceEditor.java +++ b/app/src/main/java/com/github/mobile/util/SourceEditor.java @@ -74,6 +74,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { WebSettings settings = view.getSettings(); settings.setJavaScriptEnabled(true); settings.setBuiltInZoomControls(true); + settings.setUseWideViewPort(true); view.addJavascriptInterface(this, "SourceEditor"); this.view = view; From ba7e0fcae6a470406a949a41f1786fd171088bdd Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Sat, 19 Jan 2013 03:38:00 +0200 Subject: [PATCH 0151/1055] Add markdown processing of source code files Closes #306 Closes #310 --- .../com/github/mobile/ui/BaseActivity.java | 4 +- .../com/github/mobile/ui/MarkdownLoader.java | 12 +++- .../ui/comment/RenderedCommentFragment.java | 2 +- .../mobile/ui/ref/BranchFileViewActivity.java | 70 +++++++++++++++++-- .../com/github/mobile/util/SourceEditor.java | 27 ++++++- 5 files changed, 102 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/BaseActivity.java b/app/src/main/java/com/github/mobile/ui/BaseActivity.java index 4474d62f7..bbdce341b 100644 --- a/app/src/main/java/com/github/mobile/ui/BaseActivity.java +++ b/app/src/main/java/com/github/mobile/ui/BaseActivity.java @@ -18,14 +18,14 @@ import android.os.Bundle; import com.github.kevinsawicki.wishlist.ViewFinder; -import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockActivity; +import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockFragmentActivity; import java.io.Serializable; /** * Base sherlock activity */ -public class BaseActivity extends RoboSherlockActivity { +public class BaseActivity extends RoboSherlockFragmentActivity { /** * Finder bound to this activity's view diff --git a/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java b/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java index c42aa280d..06362a96f 100644 --- a/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java +++ b/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java @@ -43,6 +43,8 @@ public class MarkdownLoader extends AuthenticatedUserLoader { private final String raw; + private boolean encode; + @Inject private MarkdownService service; @@ -51,14 +53,16 @@ public class MarkdownLoader extends AuthenticatedUserLoader { * @param repository * @param raw * @param imageGetter + * @param encode */ public MarkdownLoader(Context context, IRepositoryIdProvider repository, - String raw, ImageGetter imageGetter) { + String raw, ImageGetter imageGetter, boolean encode) { super(context); this.repository = repository; this.raw = raw; this.imageGetter = imageGetter; + this.encode = encode; } @Override @@ -74,7 +78,11 @@ public CharSequence load(Account account) { html = service.getRepositoryHtml(repository, raw); else html = service.getHtml(raw, MODE_GFM); - return HtmlUtils.encode(html, imageGetter); + + if (encode) + return HtmlUtils.encode(html, imageGetter); + else + return html; } catch (IOException e) { Log.d(TAG, "Loading rendered markdown failed", e); return null; diff --git a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java index f83d2c41d..a2f7cbe52 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java +++ b/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java @@ -97,7 +97,7 @@ public Loader onCreateLoader(int loader, Bundle args) { final IRepositoryIdProvider repo = (IRepositoryIdProvider) args .getSerializable(ARG_REPO); return new MarkdownLoader(getActivity(), repo, raw.toString(), - imageGetter); + imageGetter, true); } @Override diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index b4d14f321..69618d86d 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -22,6 +22,8 @@ import static com.github.mobile.util.PreferenceUtils.WRAP; import android.content.Intent; import android.os.Bundle; +import android.support.v4.app.LoaderManager; +import android.support.v4.content.Loader; import android.util.Log; import android.webkit.WebView; import android.widget.ProgressBar; @@ -38,23 +40,37 @@ import com.github.mobile.core.code.RefreshBlobTask; import com.github.mobile.core.commit.CommitUtils; import com.github.mobile.ui.BaseActivity; +import com.github.mobile.ui.MarkdownLoader; import com.github.mobile.util.AvatarLoader; +import com.github.mobile.util.HttpImageGetter; import com.github.mobile.util.PreferenceUtils; import com.github.mobile.util.ShareUtils; import com.github.mobile.util.SourceEditor; import com.github.mobile.util.ToastUtils; import com.google.inject.Inject; +import java.io.Serializable; + import org.eclipse.egit.github.core.Blob; +import org.eclipse.egit.github.core.IRepositoryIdProvider; import org.eclipse.egit.github.core.Repository; +import org.eclipse.egit.github.core.util.EncodingUtils; /** * Activity to view a file on a branch */ -public class BranchFileViewActivity extends BaseActivity { +public class BranchFileViewActivity extends BaseActivity implements + LoaderManager.LoaderCallbacks { private static final String TAG = "BranchFileViewActivity"; + private static final String ARG_TEXT = "text"; + + private static final String ARG_REPO = "repo"; + + private static final String[] MARKDOWN_EXTENSIONS = + {"md", "mkdn", "mdwn", "mdown", "markdown"}; + /** * Create intent to show file in commit * @@ -93,6 +109,9 @@ public static Intent createIntent(Repository repository, String branch, @Inject private AvatarLoader avatars; + @Inject + private HttpImageGetter imageGetter; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -155,6 +174,30 @@ public boolean onOptionsItemSelected(MenuItem item) { } } + @Override + public Loader onCreateLoader(int loader, Bundle args) { + final String raw = args.getString(ARG_TEXT); + final IRepositoryIdProvider repo = (IRepositoryIdProvider) args + .getSerializable(ARG_REPO); + return new MarkdownLoader(this, repo, raw, imageGetter, false); + } + + @Override + public void onLoadFinished(Loader loader, + CharSequence rendered) { + if (rendered == null) + ToastUtils.show(this, string.error_rendering_markdown); + + ViewUtils.setGone(loadingBar, true); + ViewUtils.setGone(codeView, false); + + editor.setMarkdown(true).setSource(file, rendered.toString(), false); + } + + @Override + public void onLoaderReset(Loader loader) { + } + private void shareFile() { String id = repo.generateId(); startActivity(ShareUtils.create(path + " at " + branch + " on " + id, @@ -168,10 +211,19 @@ private void loadContent() { protected void onSuccess(Blob blob) throws Exception { super.onSuccess(blob); - ViewUtils.setGone(loadingBar, true); - ViewUtils.setGone(codeView, false); - - editor.setSource(file, blob); + if (isMarkdown(file)) { + String markdown = new String(EncodingUtils.fromBase64(blob.getContent())); + Bundle args = new Bundle(); + args.putCharSequence(ARG_TEXT, markdown); + if (repo instanceof Serializable) + args.putSerializable(ARG_REPO, (Serializable) repo); + getSupportLoaderManager().restartLoader(0, args, BranchFileViewActivity.this); + } else { + ViewUtils.setGone(loadingBar, true); + ViewUtils.setGone(codeView, false); + + editor.setMarkdown(false).setSource(file, blob); + } } @Override @@ -187,4 +239,12 @@ protected void onException(Exception e) throws RuntimeException { } }.execute(); } + + private boolean isMarkdown(String name) { + for (int i = 0; i < MARKDOWN_EXTENSIONS.length; i++) + if (name.endsWith(MARKDOWN_EXTENSIONS[i])) + return true; + + return false; + } } diff --git a/app/src/main/java/com/github/mobile/util/SourceEditor.java b/app/src/main/java/com/github/mobile/util/SourceEditor.java index 202a1cd00..2f2878c69 100644 --- a/app/src/main/java/com/github/mobile/util/SourceEditor.java +++ b/app/src/main/java/com/github/mobile/util/SourceEditor.java @@ -48,6 +48,8 @@ public class SourceEditor { private boolean encoded; + private boolean markdown; + /** * Create source editor using given web view * @@ -124,8 +126,23 @@ public boolean getWrap() { */ public SourceEditor setWrap(final boolean wrap) { this.wrap = wrap; - if (name != null && content != null) - view.loadUrl(URL_PAGE); + if (name != null && content != null) { + if (markdown) + view.loadData(content, "text/html", null); + else + view.loadUrl(URL_PAGE); + } + return this; + } + + /** + * Sets whether the content is a markdown file + * + * @param markdown + * @return this editor + */ + public SourceEditor setMarkdown(final boolean markdown) { + this.markdown = markdown; return this; } @@ -142,7 +159,11 @@ public SourceEditor setSource(final String name, final String content, this.name = name; this.content = content; this.encoded = encoded; - view.loadUrl(URL_PAGE); + if (markdown) + view.loadData(content, "text/html", null); + else + view.loadUrl(URL_PAGE); + return this; } From 00012ad3728a3125e9d0e7b51968d9ee93001c1f Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Mon, 21 Jan 2013 22:20:24 +0200 Subject: [PATCH 0152/1055] Update markdown extensions --- .../java/com/github/mobile/ui/ref/BranchFileViewActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index 69618d86d..6286fe200 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -69,7 +69,7 @@ public class BranchFileViewActivity extends BaseActivity implements private static final String ARG_REPO = "repo"; private static final String[] MARKDOWN_EXTENSIONS = - {"md", "mkdn", "mdwn", "mdown", "markdown"}; + {"md", "mkdn", "mdwn", "mdown", "markdown", "mkd", "mkdown", "ron"}; /** * Create intent to show file in commit From de9103882791709d155d0624a61c6170c1bf4877 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 4 Feb 2013 09:58:10 -0800 Subject: [PATCH 0153/1055] Require '.' when checking markdown extensions --- .../mobile/ui/ref/BranchFileViewActivity.java | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index 6286fe200..080459338 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -24,6 +24,7 @@ import android.os.Bundle; import android.support.v4.app.LoaderManager; import android.support.v4.content.Loader; +import android.text.TextUtils; import android.util.Log; import android.webkit.WebView; import android.widget.ProgressBar; @@ -60,7 +61,7 @@ * Activity to view a file on a branch */ public class BranchFileViewActivity extends BaseActivity implements - LoaderManager.LoaderCallbacks { + LoaderManager.LoaderCallbacks { private static final String TAG = "BranchFileViewActivity"; @@ -68,8 +69,19 @@ public class BranchFileViewActivity extends BaseActivity implements private static final String ARG_REPO = "repo"; - private static final String[] MARKDOWN_EXTENSIONS = - {"md", "mkdn", "mdwn", "mdown", "markdown", "mkd", "mkdown", "ron"}; + private static final String[] MARKDOWN_EXTENSIONS = { ".md", ".mkdn", + ".mdwn", ".mdown", ".markdown", ".mkd", ".mkdown", ".ron" }; + + private static boolean isMarkdown(final String name) { + if (TextUtils.isEmpty(name)) + return false; + + for (String extension : MARKDOWN_EXTENSIONS) + if (name.endsWith(extension)) + return true; + + return false; + } /** * Create intent to show file in commit @@ -178,13 +190,13 @@ public boolean onOptionsItemSelected(MenuItem item) { public Loader onCreateLoader(int loader, Bundle args) { final String raw = args.getString(ARG_TEXT); final IRepositoryIdProvider repo = (IRepositoryIdProvider) args - .getSerializable(ARG_REPO); + .getSerializable(ARG_REPO); return new MarkdownLoader(this, repo, raw, imageGetter, false); } @Override public void onLoadFinished(Loader loader, - CharSequence rendered) { + CharSequence rendered) { if (rendered == null) ToastUtils.show(this, string.error_rendering_markdown); @@ -212,12 +224,14 @@ protected void onSuccess(Blob blob) throws Exception { super.onSuccess(blob); if (isMarkdown(file)) { - String markdown = new String(EncodingUtils.fromBase64(blob.getContent())); + String markdown = new String(EncodingUtils.fromBase64(blob + .getContent())); Bundle args = new Bundle(); args.putCharSequence(ARG_TEXT, markdown); if (repo instanceof Serializable) args.putSerializable(ARG_REPO, (Serializable) repo); - getSupportLoaderManager().restartLoader(0, args, BranchFileViewActivity.this); + getSupportLoaderManager().restartLoader(0, args, + BranchFileViewActivity.this); } else { ViewUtils.setGone(loadingBar, true); ViewUtils.setGone(codeView, false); @@ -240,11 +254,4 @@ protected void onException(Exception e) throws RuntimeException { }.execute(); } - private boolean isMarkdown(String name) { - for (int i = 0; i < MARKDOWN_EXTENSIONS.length; i++) - if (name.endsWith(MARKDOWN_EXTENSIONS[i])) - return true; - - return false; - } } From c859b808b4e4bb8a9be31f791ecde6cbd562f2f2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 4 Feb 2013 09:58:44 -0800 Subject: [PATCH 0154/1055] Import LoaderCallbacks directly --- .../java/com/github/mobile/ui/ref/BranchFileViewActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index 080459338..8a8ab75cb 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -22,7 +22,7 @@ import static com.github.mobile.util.PreferenceUtils.WRAP; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.LoaderManager; +import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.Loader; import android.text.TextUtils; import android.util.Log; @@ -61,7 +61,7 @@ * Activity to view a file on a branch */ public class BranchFileViewActivity extends BaseActivity implements - LoaderManager.LoaderCallbacks { + LoaderCallbacks { private static final String TAG = "BranchFileViewActivity"; From fb181ff9939b9c60bb239deb8207158d1c5e4da7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 4 Feb 2013 10:30:10 -0800 Subject: [PATCH 0155/1055] Hide progress when exception occurs --- .../java/com/github/mobile/ui/ItemListFragment.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java b/app/src/main/java/com/github/mobile/ui/ItemListFragment.java index a76dcdfa1..692b70f29 100644 --- a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/ItemListFragment.java @@ -139,7 +139,8 @@ public void onItemClick(AdapterView parent, View view, @Override public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { - return onListItemLongClick((ListView) parent, view, position, id); + return onListItemLongClick((ListView) parent, view, position, + id); } }); progressBar = (ProgressBar) view.findViewById(id.pb_loading); @@ -198,7 +199,8 @@ private void refresh(final Bundle args) { if (!isUsable()) return; - getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true); + getSherlockActivity() + .setSupportProgressBarIndeterminateVisibility(true); getLoaderManager().restartLoader(0, args, this); } @@ -211,6 +213,11 @@ private void refresh(final Bundle args) { protected abstract int getErrorMessage(Exception exception); public void onLoadFinished(Loader> loader, List items) { + if (!isUsable()) + return; + + getSherlockActivity().setSupportProgressBarIndeterminateVisibility( + false); Exception exception = getException(loader); if (exception != null) { showError(exception, getErrorMessage(exception)); @@ -221,8 +228,6 @@ public void onLoadFinished(Loader> loader, List items) { this.items = items; getListAdapter().getWrappedAdapter().setItems(items.toArray()); showList(); - - getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false); } /** From b6d8c3b9f625c5466e96bfd4ec4c061e57f1456f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 4 Feb 2013 10:48:13 -0800 Subject: [PATCH 0156/1055] Add option to switch back to raw markdown Markdown files are rendered by default when opened but can still be toggled back to raw mode which is saved as a preference. --- app/res/menu/file_view.xml | 24 +++--- app/res/values/strings.xml | 2 + .../mobile/ui/ref/BranchFileViewActivity.java | 80 ++++++++++++++++--- .../github/mobile/util/PreferenceUtils.java | 5 ++ .../com/github/mobile/util/SourceEditor.java | 27 ++++--- 5 files changed, 108 insertions(+), 30 deletions(-) diff --git a/app/res/menu/file_view.xml b/app/res/menu/file_view.xml index 4c317eb45..dfd43092b 100644 --- a/app/res/menu/file_view.xml +++ b/app/res/menu/file_view.xml @@ -16,14 +16,20 @@ --> - - + + + \ No newline at end of file diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index 0a25acbbc..5af21de29 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -258,5 +258,7 @@ Show password Write Preview + Show raw markdown + Render markdown diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index 8a8ab75cb..1e30daffe 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -19,6 +19,7 @@ import static com.github.mobile.Intents.EXTRA_HEAD; import static com.github.mobile.Intents.EXTRA_PATH; import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.mobile.util.PreferenceUtils.RENDER_MARKDOWN; import static com.github.mobile.util.PreferenceUtils.WRAP; import android.content.Intent; import android.os.Bundle; @@ -112,12 +113,20 @@ public static Intent createIntent(Repository repository, String branch, private String branch; + private boolean isMarkdownFile; + + private String renderedMarkdown; + + private Blob blob; + private ProgressBar loadingBar; private WebView codeView; private SourceEditor editor; + private MenuItem markdownItem; + @Inject private AvatarLoader avatars; @@ -139,6 +148,7 @@ protected void onCreate(Bundle savedInstanceState) { codeView = finder.find(id.wv_code); file = CommitUtils.getName(path); + isMarkdownFile = isMarkdown(file); editor = new SourceEditor(codeView); editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean( WRAP, false)); @@ -161,6 +171,17 @@ public boolean onCreateOptionsMenu(final Menu optionsMenu) { else wrapItem.setTitle(string.enable_wrapping); + markdownItem = optionsMenu.findItem(id.m_render_markdown); + if (isMarkdownFile) { + markdownItem.setEnabled(blob != null); + markdownItem.setVisible(true); + if (PreferenceUtils.getCodePreferences(this).getBoolean( + RENDER_MARKDOWN, true)) + markdownItem.setTitle(string.show_raw_markdown); + else + markdownItem.setTitle(string.render_markdown); + } + return true; } @@ -181,6 +202,22 @@ public boolean onOptionsItemSelected(MenuItem item) { case id.m_share: shareFile(); return true; + case id.m_render_markdown: + if (editor.isMarkdown()) { + item.setTitle(string.render_markdown); + editor.setMarkdown(false); + editor.setSource(file, blob); + } else { + item.setTitle(string.show_raw_markdown); + editor.setMarkdown(true); + if (renderedMarkdown != null) + editor.setSource(file, renderedMarkdown, false); + else + loadMarkdown(); + } + PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) + .edit().putBoolean(RENDER_MARKDOWN, editor.isMarkdown())); + return true; default: return super.onOptionsItemSelected(item); } @@ -203,7 +240,12 @@ public void onLoadFinished(Loader loader, ViewUtils.setGone(loadingBar, true); ViewUtils.setGone(codeView, false); - editor.setMarkdown(true).setSource(file, rendered.toString(), false); + if (!TextUtils.isEmpty(rendered)) { + renderedMarkdown = rendered.toString(); + if (markdownItem != null) + markdownItem.setEnabled(true); + editor.setMarkdown(true).setSource(file, renderedMarkdown, false); + } } @Override @@ -216,23 +258,39 @@ private void shareFile() { "https://github.com/" + id + "/blob/" + branch + '/' + path)); } + private void loadMarkdown() { + ViewUtils.setGone(loadingBar, false); + ViewUtils.setGone(codeView, true); + + String markdown = new String( + EncodingUtils.fromBase64(blob.getContent())); + Bundle args = new Bundle(); + args.putCharSequence(ARG_TEXT, markdown); + if (repo instanceof Serializable) + args.putSerializable(ARG_REPO, (Serializable) repo); + getSupportLoaderManager().restartLoader(0, args, this); + } + private void loadContent() { + ViewUtils.setGone(loadingBar, false); + ViewUtils.setGone(codeView, true); + new RefreshBlobTask(repo, sha, this) { @Override protected void onSuccess(Blob blob) throws Exception { super.onSuccess(blob); - if (isMarkdown(file)) { - String markdown = new String(EncodingUtils.fromBase64(blob - .getContent())); - Bundle args = new Bundle(); - args.putCharSequence(ARG_TEXT, markdown); - if (repo instanceof Serializable) - args.putSerializable(ARG_REPO, (Serializable) repo); - getSupportLoaderManager().restartLoader(0, args, - BranchFileViewActivity.this); - } else { + if (markdownItem != null) + markdownItem.setEnabled(true); + + BranchFileViewActivity.this.blob = blob; + if (isMarkdownFile + && PreferenceUtils.getCodePreferences( + BranchFileViewActivity.this).getBoolean( + RENDER_MARKDOWN, true)) + loadMarkdown(); + else { ViewUtils.setGone(loadingBar, true); ViewUtils.setGone(codeView, false); diff --git a/app/src/main/java/com/github/mobile/util/PreferenceUtils.java b/app/src/main/java/com/github/mobile/util/PreferenceUtils.java index ba2662bc5..36dcf0f07 100644 --- a/app/src/main/java/com/github/mobile/util/PreferenceUtils.java +++ b/app/src/main/java/com/github/mobile/util/PreferenceUtils.java @@ -32,6 +32,11 @@ public class PreferenceUtils { */ public static final String WRAP = "wrap"; + /** + * Preference to render markdown + */ + public static final String RENDER_MARKDOWN = "renderMarkdown"; + /** * Get code browsing preferences * diff --git a/app/src/main/java/com/github/mobile/util/SourceEditor.java b/app/src/main/java/com/github/mobile/util/SourceEditor.java index 2f2878c69..4ad9abdfd 100644 --- a/app/src/main/java/com/github/mobile/util/SourceEditor.java +++ b/app/src/main/java/com/github/mobile/util/SourceEditor.java @@ -118,6 +118,13 @@ public boolean getWrap() { return wrap; } + /** + * @return markdown + */ + public boolean isMarkdown() { + return markdown; + } + /** * Set whether lines should wrap * @@ -126,12 +133,7 @@ public boolean getWrap() { */ public SourceEditor setWrap(final boolean wrap) { this.wrap = wrap; - if (name != null && content != null) { - if (markdown) - view.loadData(content, "text/html", null); - else - view.loadUrl(URL_PAGE); - } + loadSource(); return this; } @@ -159,14 +161,19 @@ public SourceEditor setSource(final String name, final String content, this.name = name; this.content = content; this.encoded = encoded; - if (markdown) - view.loadData(content, "text/html", null); - else - view.loadUrl(URL_PAGE); + loadSource(); return this; } + private void loadSource() { + if (name != null && content != null) + if (markdown) + view.loadData(content, "text/html", null); + else + view.loadUrl(URL_PAGE); + } + /** * Bind blob content to current {@link WebView} * From eb3f4070b6bdc99a1a77d2bbe63e2f4e88077fbc Mon Sep 17 00:00:00 2001 From: Erkan Date: Tue, 5 Feb 2013 20:44:53 +0100 Subject: [PATCH 0157/1055] Update app/res/values-fr/strings.xml Closes #317 --- app/res/values-fr/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/res/values-fr/strings.xml b/app/res/values-fr/strings.xml index 5adbc11ca..e7fa3904b 100644 --- a/app/res/values-fr/strings.xml +++ b/app/res/values-fr/strings.xml @@ -233,6 +233,7 @@ Désabonnement… Ajout aux favrois… Supprimer des favoris… + Aller à… repositories @@ -257,4 +258,7 @@ Voir mot de passe Ecrire Pré-visualiser + Afficher la syntaxe markdown + Afficher le rendu markdown + From 2a3e1bc23883cecc3517d22222b4303927c27aa6 Mon Sep 17 00:00:00 2001 From: Rafael Alves Date: Mon, 4 Mar 2013 19:10:19 -0300 Subject: [PATCH 0158/1055] Fix "unassigned" in pt translation Closes #325 --- app/res/values-pt/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/res/values-pt/strings.xml b/app/res/values-pt/strings.xml index 70a4b05f5..ce11ccb81 100644 --- a/app/res/values-pt/strings.xml +++ b/app/res/values-pt/strings.xml @@ -135,7 +135,7 @@ Selecionar Milestone Selecionar Rótulos Nenhuma milestone - Nenhum resposável + Nenhum responsável é o responsável Nenhum Gist encontrado Confirmar Exclusão @@ -201,4 +201,4 @@ Comparar Commit Commit\u0020 - \ No newline at end of file + From bef48244e2bbf3604aca855391486574ee8985e3 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Thu, 21 Mar 2013 23:48:07 +0200 Subject: [PATCH 0159/1055] Update Ukrainian locale Closes #331 --- app/res/values-uk/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/res/values-uk/strings.xml b/app/res/values-uk/strings.xml index ab9accf24..bfa2f9595 100644 --- a/app/res/values-uk/strings.xml +++ b/app/res/values-uk/strings.xml @@ -233,6 +233,7 @@ Відписка… Додавання до улюблених… Видалення із улюблених… + Перейти до… репозиторії @@ -257,5 +258,7 @@ Показати пароль Написати Переглянути + Показати код markdown + Відмалювати markdown From a7d58202e537c7b68cd7c0b5575980fc4408781d Mon Sep 17 00:00:00 2001 From: Yuval Aboulafia Date: Fri, 22 Mar 2013 15:54:48 +0200 Subject: [PATCH 0160/1055] Add Hebrew translation Closes #332 --- app/res/values-iw/strings.xml | 264 ++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 app/res/values-iw/strings.xml diff --git a/app/res/values-iw/strings.xml b/app/res/values-iw/strings.xml new file mode 100644 index 000000000..b398a9459 --- /dev/null +++ b/app/res/values-iw/strings.xml @@ -0,0 +1,264 @@ + + + + + + טעינת ארגון משתמש & נכשלה + נכשלה טעינת סוגיות + טעינת מאגרים נכשלה + טעינת מאגר נכשלה + טעינת תמצית נכשלה + טעינת חדשות נכשלה + טעינת עוקבים נכשלה + טעינת אנשים נכשלה + טעינת איש נכשלה + טעינת תוכן תמצית נכשלה + טעינת תמציות נכשלה + טעינת סוגיה נכשלה + טעינת מסייעים נכשלה + טעינת אבני-דרך נכשלה + טעינת תבניות נכשלה + טעינת סימניות נכשלה + טעינת חברים נכשלה + טעינת רישומים נכשלה + טעינת רישום נכשלה + טעינת הקובץ נכשלה + טעינת הקוד נכשלה + טעינת תגי ענף & נכשלה + מעקב נכשל + ביטול מעקב נכשל + בדיקת מצב מעקב נכשלה + סימון בכוכב נכשל + ביטול סימון בכוכב נכשל + בדיקת מצב סימון בכוכב נכשלה + עיבוד הוזלה נכשל + + + + + טוען תמצית... + טוען תמצית אקראית... + טוען עוד סוגיות... + טוען סוגיות… + טוען תגובות... + טוען מאגרים… + טוען סוגיה… + טוען חדשות… + טוען עוקבים… + טוען אנשים… + טוען תמציות... + טוען מסייעים... + טוען אבני-דרך... + טוען תוויות... + טוען רישומים... + טוען תגובות קבצי & + טוען תגיות ענף & + + + + + אין סימניות + אין מאגרים + אין סוגיות + אין תמצותים + אין אנשים + אין עוקבים + אין חברים + אין חדשות + אין רשומות לביצוע + + + + + מעדכן מוצב... + מעדכן סוגייה... + מעדכן תווית... + מעדכן אבן-דרך... + + + GitHub + חדשות + סוגיות + תמצותים + משימות לביצוע + מצא מאגרים + מצא סוגיות + חפש... + נקה הסטוריה + הסטוריית חיפוש נוקתה + מתחבר… + יוצר תמצית… + צור + צור תמצית + יוצר '\Hello world\' + הפוך תמצית זו לציבורית + file.rb + תמצית + תגובות + קבצים + פתח + אקראי + שם קובץ + תוכן קובץ + תמצית חדשה + מסנן + סימנייה + הגב + מחק + רענן + לוח סוגיות + סימניות + תימצותים + סוגיה # + בקשת משיכה # + תמצית\u0020 + סנן סוגיות + צור תגובה + הכנס תגובה + הצג עוד… + מאגרים + סוגיות + ערוך תוויות + אבן דרך: + ערוך אבן דרך + ערוך הצבה + תיאור + תמצית שנוצרה בAndroid + כותרת + ערוך + מסמן תמצית בכוכב + מבטל סימון בכוכב... + משתמש + בחר מוצב + בחר אבן דרך + בחר תוויות + בחר ענף או תג + אין אבן דרך + אף אחד לא מוצב + משוייך + לא נמצאו תמציות + אשר מחיקה + אתה בטוח שברצונך למחוק תמצית זו? + מוחק תמצית… + יוצר תגובה… + אתה בטוח שברצונך להמחוק סימנייה זו? + לוח סוגיות + סוגייה חדשה + אנונימי + מסנן סוגיות נשמר במועדפים + אחרונים + מצב: + פתוח + סגור + משוייך אל: + כולם + אבן דרך: + שום דבר + תוויות: + התחבר + חדש ב-GitHub? < href=\"https://github.com/plans\">לחץ כאן < / > כדי להירשם + לא יכול להתחבר ל- GitHub + נא הכנס סיסמת התחברות & תקינה + נא הכנס סיסמה תקינה + סיסמה + התחבר או דוא"\ל + עוקבים + עוקב אחרי + עוקבים + עוקב אחרי + עקוב + אל תעקוב + סמן בכוכב + אל תסמן בכוכב + חברים + סוגר סוגיה… + פותח סוגיה מחדש… + אווטאר + יוצר סוגיה… + נוצר\u0020 + עודכן\u0020 + נפתח\u0020 + נקה + סוגיות פתוחות + סוגיות סגורות + הסר סימנייה + שמור + החל + תוויות: + הצבה + אבן דרך + תוויות + אתה בטוח שברצונך לסגור סוגיה זו? + אתה בטוח שברצונך לפתוח סוגיה זו מחדש? + סגור סוגיה + פתח סוגיה מחדש + סגור + לא נוסף תיאור + סגור + פתח מחדש + כתובת GitHub לא תקינה + לא היתה אפשרות לפתוח את כתובת ה-URL על-ידי יישום זה: \n {0} + נצפה לאחרונה + ביטול + התנגשות יישום + Another installed app is already configured for GitHub authentication.\n\nYou must remove the other app from the Accounts & sync settings and uninstall it before the GitHub app can be used. + פותח {0}… + השווה משימות + משימה\u0020 + הורה\u0020 + נוצר על-ידי + בוצע + מה תרצה לעשות? + הגב בתוך הקוד + הצג קובץ שלם + משווה {0} רשומות + אפשר התאמה + בטל התאמה + קוד + עוקב... + לא עוקב... + מסמן בכוכב... + מבטל סימון בכוכב... + נווט אל… + + + מאגרים + חדשות + עוקב + עוקבים + עוקב + עוקבים + חברים + קוד + ר + סוגיות + נצפה + מוצב + נוצר + מוזכר + שלי + מסומן בכוכב + הכל + + שתף + הצג סיסמה + כתוב + תצוגה מקדימה + Show raw markdown + Render markdown + + From 77e5da7cccf9389112ae7cb3409d8b20bf312cf4 Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Fri, 5 Apr 2013 15:09:12 +0300 Subject: [PATCH 0161/1055] Upgrade http request to version 4.1 Closes #340 --- app/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pom.xml b/app/pom.xml index 86e7162b7..cd80255a4 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -68,7 +68,7 @@ com.github.kevinsawicki http-request - 3.0 + 4.1 com.github.kevinsawicki From 503f84739f2b4ca4ee96947f4cdf4202d026e3f4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 26 Apr 2013 11:09:09 -0700 Subject: [PATCH 0162/1055] Remove Ruby code string from Hebrew translation --- app/res/values-iw/strings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/res/values-iw/strings.xml b/app/res/values-iw/strings.xml index b398a9459..1a21b3d1a 100644 --- a/app/res/values-iw/strings.xml +++ b/app/res/values-iw/strings.xml @@ -104,7 +104,6 @@ יוצר תמצית… צור צור תמצית - יוצר '\Hello world\' הפוך תמצית זו לציבורית file.rb תמצית From 28e15f2420ef362759c7927c9039f051dd1702d6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 26 Apr 2013 11:10:42 -0700 Subject: [PATCH 0163/1055] Upgrade to android-maven-plugin 3.5.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 83e894b60..4ea09508a 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ com.jayway.maven.plugins.android.generation2 android-maven-plugin - 3.4.1 + 3.5.3 true From fd2e0cc071beccc8b994bab95d746e29b95be837 Mon Sep 17 00:00:00 2001 From: Anup Cowkur Date: Thu, 28 Mar 2013 15:04:26 +0530 Subject: [PATCH 0164/1055] Add Share button repository view Closes #335 --- app/res/menu/repository_share.xml | 24 +++++++++++++++++++ app/res/values/strings.xml | 1 + .../ui/repo/RepositoryViewActivity.java | 15 +++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 app/res/menu/repository_share.xml diff --git a/app/res/menu/repository_share.xml b/app/res/menu/repository_share.xml new file mode 100644 index 000000000..b04979753 --- /dev/null +++ b/app/res/menu/repository_share.xml @@ -0,0 +1,24 @@ + + + + + + + \ No newline at end of file diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index 5af21de29..a08956b0c 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -234,6 +234,7 @@ Starring… Unstarring… Navigate to… + Share this Repo! repositories diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index fdab36ced..5c8bbabb2 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -30,6 +30,7 @@ import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.mobile.Intents.Builder; @@ -47,6 +48,7 @@ import com.github.mobile.util.AvatarLoader; import com.github.mobile.util.ToastUtils; import com.google.inject.Inject; +import com.github.mobile.util.ShareUtils; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; @@ -125,7 +127,9 @@ protected void onException(Exception e) throws RuntimeException { @Override public boolean onCreateOptionsMenu(Menu optionsMenu) { - getSupportMenuInflater().inflate(menu.repository_star, optionsMenu); + MenuInflater inflater = getSupportMenuInflater(); + inflater.inflate(menu.repository_star, optionsMenu); + inflater.inflate(menu.repository_share, optionsMenu); return super.onCreateOptionsMenu(optionsMenu); } @@ -172,6 +176,9 @@ public boolean onOptionsItemSelected(MenuItem item) { case id.m_star: starRepository(); return true; + case id.m_share: + shareRepositoryURL(); + return true; case android.R.id.home: finish(); Intent intent = new Intent(this, HomeActivity.class); @@ -270,4 +277,10 @@ protected void onSuccess(Boolean watching) throws Exception { } }.execute(); } + + private void shareRepositoryURL() { + Intent sharingIntent = ShareUtils.create(repository.getName(), repository.getHtmlUrl()); + startActivity(Intent.createChooser(sharingIntent, getResources() + .getText(string.share_repo))); + } } \ No newline at end of file From 87eb341943419d0cdccf544cbf6dc6fe53878251 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 26 Apr 2013 12:01:41 -0700 Subject: [PATCH 0165/1055] Combine star and share repository menus --- app/res/menu/{repository_star.xml => repository.xml} | 6 +++++- app/res/menu/repository_share.xml | 7 ++----- .../com/github/mobile/ui/repo/RepositoryViewActivity.java | 7 ++----- 3 files changed, 9 insertions(+), 11 deletions(-) rename app/res/menu/{repository_star.xml => repository.xml} (86%) diff --git a/app/res/menu/repository_star.xml b/app/res/menu/repository.xml similarity index 86% rename from app/res/menu/repository_star.xml rename to app/res/menu/repository.xml index 9fa4970b4..fd94ce036 100644 --- a/app/res/menu/repository_star.xml +++ b/app/res/menu/repository.xml @@ -20,5 +20,9 @@ android:id="@+id/m_star" android:showAsAction="never" android:title="@string/star"/> + - \ No newline at end of file + diff --git a/app/res/menu/repository_share.xml b/app/res/menu/repository_share.xml index b04979753..990e70a94 100644 --- a/app/res/menu/repository_share.xml +++ b/app/res/menu/repository_share.xml @@ -16,9 +16,6 @@ --> - - \ No newline at end of file + + diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 5c8bbabb2..fab2c4aea 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -127,10 +127,7 @@ protected void onException(Exception e) throws RuntimeException { @Override public boolean onCreateOptionsMenu(Menu optionsMenu) { - MenuInflater inflater = getSupportMenuInflater(); - inflater.inflate(menu.repository_star, optionsMenu); - inflater.inflate(menu.repository_share, optionsMenu); - + getSupportMenuInflater().inflate(menu.repository, optionsMenu); return super.onCreateOptionsMenu(optionsMenu); } @@ -283,4 +280,4 @@ private void shareRepositoryURL() { startActivity(Intent.createChooser(sharingIntent, getResources() .getText(string.share_repo))); } -} \ No newline at end of file +} From 7582b193e7ee415e07eb1fd02526528e03ae5413 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 26 Apr 2013 12:07:32 -0700 Subject: [PATCH 0166/1055] Start share intent without chooser This is to be consistent with other share actions in the app. Also use the repository id as the subject instead of just the name. --- app/res/values/strings.xml | 1 - .../com/github/mobile/ui/repo/RepositoryViewActivity.java | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index a08956b0c..5af21de29 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -234,7 +234,6 @@ Starring… Unstarring… Navigate to… - Share this Repo! repositories diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index fab2c4aea..296303f56 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -276,8 +276,8 @@ protected void onSuccess(Boolean watching) throws Exception { } private void shareRepositoryURL() { - Intent sharingIntent = ShareUtils.create(repository.getName(), repository.getHtmlUrl()); - startActivity(Intent.createChooser(sharingIntent, getResources() - .getText(string.share_repo))); + Intent sharingIntent = ShareUtils.create(repository.generateId(), + repository.getHtmlUrl()); + startActivity(sharingIntent); } } From 240d6e75f3814059853cd85cc0f48d5b788f997a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 26 Apr 2013 12:13:07 -0700 Subject: [PATCH 0167/1055] Generate repository URL when is it missing This will be the case when it is pulled from the local cache. --- .../github/mobile/ui/repo/RepositoryViewActivity.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 296303f56..c5b1306f5 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -26,6 +26,7 @@ import static com.github.mobile.util.TypefaceUtils.ICON_NEWS; import android.content.Intent; import android.os.Bundle; +import android.text.TextUtils; import android.widget.ProgressBar; import com.actionbarsherlock.app.ActionBar; @@ -174,7 +175,7 @@ public boolean onOptionsItemSelected(MenuItem item) { starRepository(); return true; case id.m_share: - shareRepositoryURL(); + shareRepository(); return true; case android.R.id.home: finish(); @@ -275,9 +276,12 @@ protected void onSuccess(Boolean watching) throws Exception { }.execute(); } - private void shareRepositoryURL() { + private void shareRepository() { + String repoUrl = repository.getHtmlUrl(); + if (TextUtils.isEmpty(repoUrl)) + repoUrl = "https://github.com/" + repository.generateId(); Intent sharingIntent = ShareUtils.create(repository.generateId(), - repository.getHtmlUrl()); + repoUrl); startActivity(sharingIntent); } } From 0d5179033dcc4831e540a0f41bf542d26fcbd437 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 29 Apr 2013 09:20:30 -0700 Subject: [PATCH 0168/1055] Upgrade to GitHub Java API 2.1.3 --- app/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/pom.xml b/app/pom.xml index cd80255a4..a90bd1698 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -63,7 +63,7 @@ org.eclipse.mylyn.github org.eclipse.egit.github.core - 2.1.2 + 2.1.3 com.github.kevinsawicki @@ -114,7 +114,7 @@ release - From 9f7f3053520ffff4571f97695096af66198fe5a3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 30 Apr 2013 08:07:48 -0700 Subject: [PATCH 0169/1055] Downgrade to GitHub Java API 2.1.2 This is only temporary until 2.1.4 syncs to Maven Central and then that version will be used. --- app/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pom.xml b/app/pom.xml index a90bd1698..20b6648cf 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -63,7 +63,7 @@ org.eclipse.mylyn.github org.eclipse.egit.github.core - 2.1.3 + 2.1.2 com.github.kevinsawicki From 6bca3daf0b84c1d3b56b1d57658f4a718472e054 Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Sat, 6 Apr 2013 01:38:17 -0600 Subject: [PATCH 0170/1055] Markdown files render in commit view Now when you click on the header for a markdown file in the commit list view it acts the same way as if you were viewing the file in the source tree view (i.e. the file can either be rendered or shown in its raw form) Closes #343 --- .../ui/commit/CommitFileViewActivity.java | 144 +++++++++++++++++- .../mobile/ui/ref/BranchFileViewActivity.java | 19 ++- .../com/github/mobile/util/SourceEditor.java | 9 ++ 3 files changed, 158 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java index f4645c35e..f3a78c331 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java @@ -19,9 +19,14 @@ import static com.github.mobile.Intents.EXTRA_HEAD; import static com.github.mobile.Intents.EXTRA_PATH; import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.mobile.util.PreferenceUtils.RENDER_MARKDOWN; import static com.github.mobile.util.PreferenceUtils.WRAP; + import android.content.Intent; import android.os.Bundle; +import android.support.v4.app.LoaderManager.LoaderCallbacks; +import android.support.v4.content.Loader; +import android.text.TextUtils; import android.util.Log; import android.webkit.WebView; import android.widget.ProgressBar; @@ -38,24 +43,49 @@ import com.github.mobile.core.code.RefreshBlobTask; import com.github.mobile.core.commit.CommitUtils; import com.github.mobile.ui.BaseActivity; +import com.github.mobile.ui.MarkdownLoader; import com.github.mobile.util.AvatarLoader; +import com.github.mobile.util.HttpImageGetter; import com.github.mobile.util.PreferenceUtils; import com.github.mobile.util.ShareUtils; import com.github.mobile.util.SourceEditor; import com.github.mobile.util.ToastUtils; import com.google.inject.Inject; +import java.io.Serializable; + import org.eclipse.egit.github.core.Blob; import org.eclipse.egit.github.core.CommitFile; +import org.eclipse.egit.github.core.IRepositoryIdProvider; import org.eclipse.egit.github.core.Repository; +import org.eclipse.egit.github.core.util.EncodingUtils; /** * Activity to display the contents of a file in a commit */ -public class CommitFileViewActivity extends BaseActivity { +public class CommitFileViewActivity extends BaseActivity implements + LoaderCallbacks { private static final String TAG = "CommitFileViewActivity"; + private static final String ARG_TEXT = "text"; + + private static final String ARG_REPO = "repo"; + + private static final String[] MARKDOWN_EXTENSIONS = { ".md", ".mkdn", + ".mdwn", ".mdown", ".markdown", ".mkd", ".mkdown", ".ron" }; + + private static boolean isMarkdown(final String name) { + if (TextUtils.isEmpty(name)) + return false; + + for (String extension : MARKDOWN_EXTENSIONS) + if (name.endsWith(extension)) + return true; + + return false; + } + /** * Create intent to show file in commit * @@ -82,15 +112,28 @@ public static Intent createIntent(Repository repository, String commit, private String path; + private String file; + + private boolean isMarkdownFile; + + private String renderedMarkdown; + + private Blob blob; + private ProgressBar loadingBar; private WebView codeView; private SourceEditor editor; + private MenuItem markdownItem; + @Inject private AvatarLoader avatars; + @Inject + private HttpImageGetter imageGetter; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -105,6 +148,9 @@ protected void onCreate(Bundle savedInstanceState) { loadingBar = finder.find(id.pb_loading); codeView = finder.find(id.wv_code); + file = CommitUtils.getName(path); + isMarkdownFile = isMarkdown(file); + editor = new SourceEditor(codeView); editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean( WRAP, false)); @@ -132,6 +178,17 @@ public boolean onCreateOptionsMenu(final Menu optionsMenu) { else wrapItem.setTitle(string.enable_wrapping); + markdownItem = optionsMenu.findItem(id.m_render_markdown); + if (isMarkdownFile) { + markdownItem.setEnabled(blob != null); + markdownItem.setVisible(true); + if (PreferenceUtils.getCodePreferences(this).getBoolean( + RENDER_MARKDOWN, true)) + markdownItem.setTitle(string.show_raw_markdown); + else + markdownItem.setTitle(string.render_markdown); + } + return true; } @@ -139,24 +196,70 @@ public boolean onCreateOptionsMenu(final Menu optionsMenu) { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case id.m_wrap: - if (editor.getWrap()) { + if (editor.getWrap()) item.setTitle(string.enable_wrapping); - editor.setWrap(false); - } else { + else item.setTitle(string.disable_wrapping); - editor.setWrap(true); - } + editor.toggleWrap(); PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) .edit().putBoolean(WRAP, editor.getWrap())); return true; + case id.m_share: shareFile(); return true; + + case id.m_render_markdown: + if (editor.isMarkdown()) { + item.setTitle(string.render_markdown); + editor.toggleMarkdown(); + editor.setSource(file, blob); + } else { + item.setTitle(string.show_raw_markdown); + editor.toggleMarkdown(); + if (renderedMarkdown != null) + editor.setSource(file, renderedMarkdown, false); + else + loadMarkdown(); + } + PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) + .edit().putBoolean(RENDER_MARKDOWN, editor.isMarkdown())); + return true; + default: return super.onOptionsItemSelected(item); } } + @Override + public Loader onCreateLoader(int loader, Bundle args) { + final String raw = args.getString(ARG_TEXT); + final IRepositoryIdProvider repo = (IRepositoryIdProvider) args + .getSerializable(ARG_REPO); + return new MarkdownLoader(this, repo, raw, imageGetter, false); + } + + @Override + public void onLoadFinished(Loader loader, + CharSequence rendered) { + if (rendered == null) + ToastUtils.show(this, string.error_rendering_markdown); + + ViewUtils.setGone(loadingBar, true); + ViewUtils.setGone(codeView, false); + + if (!TextUtils.isEmpty(rendered)) { + renderedMarkdown = rendered.toString(); + if (markdownItem != null) + markdownItem.setEnabled(true); + editor.setMarkdown(true).setSource(file, renderedMarkdown, false); + } + } + + @Override + public void onLoaderReset(Loader loader) { + } + private void shareFile() { String id = repo.generateId(); startActivity(ShareUtils.create( @@ -164,6 +267,19 @@ private void shareFile() { "https://github.com/" + id + "/blob/" + commit + '/' + path)); } + private void loadMarkdown() { + ViewUtils.setGone(loadingBar, false); + ViewUtils.setGone(codeView, true); + + String markdown = new String( + EncodingUtils.fromBase64(blob.getContent())); + Bundle args = new Bundle(); + args.putCharSequence(ARG_TEXT, markdown); + if (repo instanceof Serializable) + args.putSerializable(ARG_REPO, (Serializable) repo); + getSupportLoaderManager().restartLoader(0, args, this); + } + private void loadContent() { new RefreshBlobTask(repo, sha, this) { @@ -175,6 +291,21 @@ protected void onSuccess(Blob blob) throws Exception { ViewUtils.setGone(codeView, false); editor.setSource(path, blob); + CommitFileViewActivity.this.blob = blob; + + if (markdownItem != null) + markdownItem.setEnabled(true); + + if (isMarkdownFile + && PreferenceUtils.getCodePreferences( + CommitFileViewActivity.this).getBoolean( + RENDER_MARKDOWN, true)) + loadMarkdown(); + else { + ViewUtils.setGone(loadingBar, true); + ViewUtils.setGone(codeView, false); + editor.setSource(path, blob); + } } @Override @@ -190,4 +321,5 @@ protected void onException(Exception e) throws RuntimeException { } }.execute(); } + } diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index 1e30daffe..f5534509a 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -21,6 +21,7 @@ import static com.github.mobile.Intents.EXTRA_REPOSITORY; import static com.github.mobile.util.PreferenceUtils.RENDER_MARKDOWN; import static com.github.mobile.util.PreferenceUtils.WRAP; + import android.content.Intent; import android.os.Bundle; import android.support.v4.app.LoaderManager.LoaderCallbacks; @@ -189,27 +190,27 @@ public boolean onCreateOptionsMenu(final Menu optionsMenu) { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case id.m_wrap: - if (editor.getWrap()) { + if (editor.getWrap()) item.setTitle(string.enable_wrapping); - editor.setWrap(false); - } else { + else item.setTitle(string.disable_wrapping); - editor.setWrap(true); - } + editor.toggleWrap(); PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) .edit().putBoolean(WRAP, editor.getWrap())); return true; + case id.m_share: shareFile(); return true; + case id.m_render_markdown: if (editor.isMarkdown()) { item.setTitle(string.render_markdown); - editor.setMarkdown(false); + editor.toggleMarkdown(); editor.setSource(file, blob); } else { item.setTitle(string.show_raw_markdown); - editor.setMarkdown(true); + editor.toggleMarkdown(); if (renderedMarkdown != null) editor.setSource(file, renderedMarkdown, false); else @@ -218,6 +219,7 @@ public boolean onOptionsItemSelected(MenuItem item) { PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) .edit().putBoolean(RENDER_MARKDOWN, editor.isMarkdown())); return true; + default: return super.onOptionsItemSelected(item); } @@ -281,10 +283,11 @@ private void loadContent() { protected void onSuccess(Blob blob) throws Exception { super.onSuccess(blob); + BranchFileViewActivity.this.blob = blob; + if (markdownItem != null) markdownItem.setEnabled(true); - BranchFileViewActivity.this.blob = blob; if (isMarkdownFile && PreferenceUtils.getCodePreferences( BranchFileViewActivity.this).getBoolean( diff --git a/app/src/main/java/com/github/mobile/util/SourceEditor.java b/app/src/main/java/com/github/mobile/util/SourceEditor.java index 4ad9abdfd..197018be0 100644 --- a/app/src/main/java/com/github/mobile/util/SourceEditor.java +++ b/app/src/main/java/com/github/mobile/util/SourceEditor.java @@ -198,4 +198,13 @@ public SourceEditor setSource(final String name, final Blob blob) { public SourceEditor toggleWrap() { return setWrap(!wrap); } + + /** + * Toggle markdown file rendering + * + * @return this editor + */ + public SourceEditor toggleMarkdown() { + return setMarkdown(!markdown); + } } From df3e5623836a9525bea488cb200aecf3cee77511 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 30 Apr 2013 10:22:33 -0700 Subject: [PATCH 0171/1055] DRY up markdown extension checking Create new utils package class to check if file name has a markdown extension. --- .../ui/commit/CommitFileViewActivity.java | 17 +------ .../mobile/ui/ref/BranchFileViewActivity.java | 17 +------ .../com/github/mobile/util/MarkdownUtils.java | 44 +++++++++++++++++++ 3 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 app/src/main/java/com/github/mobile/util/MarkdownUtils.java diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java index f3a78c331..a5999b731 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java @@ -46,6 +46,7 @@ import com.github.mobile.ui.MarkdownLoader; import com.github.mobile.util.AvatarLoader; import com.github.mobile.util.HttpImageGetter; +import com.github.mobile.util.MarkdownUtils; import com.github.mobile.util.PreferenceUtils; import com.github.mobile.util.ShareUtils; import com.github.mobile.util.SourceEditor; @@ -72,20 +73,6 @@ public class CommitFileViewActivity extends BaseActivity implements private static final String ARG_REPO = "repo"; - private static final String[] MARKDOWN_EXTENSIONS = { ".md", ".mkdn", - ".mdwn", ".mdown", ".markdown", ".mkd", ".mkdown", ".ron" }; - - private static boolean isMarkdown(final String name) { - if (TextUtils.isEmpty(name)) - return false; - - for (String extension : MARKDOWN_EXTENSIONS) - if (name.endsWith(extension)) - return true; - - return false; - } - /** * Create intent to show file in commit * @@ -149,7 +136,7 @@ protected void onCreate(Bundle savedInstanceState) { codeView = finder.find(id.wv_code); file = CommitUtils.getName(path); - isMarkdownFile = isMarkdown(file); + isMarkdownFile = MarkdownUtils.isMarkdown(file); editor = new SourceEditor(codeView); editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean( diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index f5534509a..e9d49b56a 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -46,6 +46,7 @@ import com.github.mobile.ui.MarkdownLoader; import com.github.mobile.util.AvatarLoader; import com.github.mobile.util.HttpImageGetter; +import com.github.mobile.util.MarkdownUtils; import com.github.mobile.util.PreferenceUtils; import com.github.mobile.util.ShareUtils; import com.github.mobile.util.SourceEditor; @@ -71,20 +72,6 @@ public class BranchFileViewActivity extends BaseActivity implements private static final String ARG_REPO = "repo"; - private static final String[] MARKDOWN_EXTENSIONS = { ".md", ".mkdn", - ".mdwn", ".mdown", ".markdown", ".mkd", ".mkdown", ".ron" }; - - private static boolean isMarkdown(final String name) { - if (TextUtils.isEmpty(name)) - return false; - - for (String extension : MARKDOWN_EXTENSIONS) - if (name.endsWith(extension)) - return true; - - return false; - } - /** * Create intent to show file in commit * @@ -149,7 +136,7 @@ protected void onCreate(Bundle savedInstanceState) { codeView = finder.find(id.wv_code); file = CommitUtils.getName(path); - isMarkdownFile = isMarkdown(file); + isMarkdownFile = MarkdownUtils.isMarkdown(file); editor = new SourceEditor(codeView); editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean( WRAP, false)); diff --git a/app/src/main/java/com/github/mobile/util/MarkdownUtils.java b/app/src/main/java/com/github/mobile/util/MarkdownUtils.java new file mode 100644 index 000000000..6d812d498 --- /dev/null +++ b/app/src/main/java/com/github/mobile/util/MarkdownUtils.java @@ -0,0 +1,44 @@ +/* + * Copyright 2013 GitHub Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.github.mobile.util; + +import android.text.TextUtils; + +/** + * Utilities for dealing with Markdown files + */ +public class MarkdownUtils { + + private static final String[] MARKDOWN_EXTENSIONS = { ".md", ".mkdn", + ".mdwn", ".mdown", ".markdown", ".mkd", ".mkdown", ".ron" }; + + /** + * Is the the given file name a Markdown file? + * + * @param name + * @return true if the name has a markdown extension, false otherwise + */ + public static boolean isMarkdown(final String name) { + if (TextUtils.isEmpty(name)) + return false; + + for (String extension : MARKDOWN_EXTENSIONS) + if (name.endsWith(extension)) + return true; + + return false; + } +} From 3938fff100066627ad8ffeded31ed914f581e094 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 May 2013 08:45:53 -0700 Subject: [PATCH 0172/1055] Downcase file name before comparing against Markdown extensions --- app/src/main/java/com/github/mobile/util/MarkdownUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/util/MarkdownUtils.java b/app/src/main/java/com/github/mobile/util/MarkdownUtils.java index 6d812d498..30c60f3be 100644 --- a/app/src/main/java/com/github/mobile/util/MarkdownUtils.java +++ b/app/src/main/java/com/github/mobile/util/MarkdownUtils.java @@ -15,6 +15,7 @@ */ package com.github.mobile.util; +import static java.util.Locale.US; import android.text.TextUtils; /** @@ -31,10 +32,11 @@ public class MarkdownUtils { * @param name * @return true if the name has a markdown extension, false otherwise */ - public static boolean isMarkdown(final String name) { + public static boolean isMarkdown(String name) { if (TextUtils.isEmpty(name)) return false; + name = name.toLowerCase(US); for (String extension : MARKDOWN_EXTENSIONS) if (name.endsWith(extension)) return true; From 2bad87b9e961136a07f98d26f7673345dd866b95 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 May 2013 08:48:11 -0700 Subject: [PATCH 0173/1055] Upgrade to GitHub Java API 2.1.4 --- app/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pom.xml b/app/pom.xml index 20b6648cf..c1610a627 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -63,7 +63,7 @@ org.eclipse.mylyn.github org.eclipse.egit.github.core - 2.1.2 + 2.1.4 com.github.kevinsawicki From 0b49f1772cf6f1aec2b4689af23ada7b939bf069 Mon Sep 17 00:00:00 2001 From: Ozan Deniz Date: Wed, 1 May 2013 23:08:23 +0300 Subject: [PATCH 0174/1055] Update Turkish translation --- app/res/values-tr/strings.xml | 71 ++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/app/res/values-tr/strings.xml b/app/res/values-tr/strings.xml index 2f1a32479..5a4173390 100644 --- a/app/res/values-tr/strings.xml +++ b/app/res/values-tr/strings.xml @@ -22,21 +22,30 @@ Depoları Yükleme Başarısız Oldu Depo Yükleme Başarısız Oldu Gist Yükleme Başarısız Oldu - Haber Yükleme Başarısız Oldu + Haberleri Yükleme Başarısız Oldu Takipçileri Yükleme Başarısız Oldu Kişileri Yükleme Başarısız Oldu Kişiyi Yükleme Başarısız Oldu - Gist Dosyası İçeriği Yükleme Başarısız Oldu + Gist İçeriği Yükleme Başarısız Oldu Gist\'leri Yükleme Başarısız Oldu Sorun Yükleme Başarısız Oldu Ortak Çalışanları Yükleme Başarısız Oldu - Kilometre Taşlarını Yükleme Başarısız Oldu + Dönüm Noktalarını Yükleme Başarısız Oldu Etiketleri Yükleme Başarısız Oldu Yer İmlerini Yükleme Başarısız Oldu Üyeleri Yükleme Başarısız Oldu Onaylamaları Yükleme Başarısız Oldu Onaylamayı Yükleme Başarısız Oldu Dosya Yükleme Başarısız Oldu + Kod Yükleme Başarısız Oldu + Dalları & Etiketleri Yükleme Başarısız Oldu + Takip Etme Başarısız Oldu + Takip Etmeyi Bırakma Başarısız Oldu + Takip Etme Kontrolü Başarısız Oldu + Yıldız Koyma Başarısız Oldu + Yıldızı Kaldırma Başarısız Oldu + Yıldız Durumunu Kontrol Etme Başarısız Oldu + Markdown dosyası render edilemdi @@ -53,10 +62,11 @@ Kişiler Yükleniyor… Gist\'ler Yükleniyor… Ortak Çalışanlar Yükleniyor… - Kilometre Taşları Yükleniyor… + Dönüm Noktaları Yükleniyor… Etiketler Yükleniyor… Onaylamalar Yükleniyor… Dosya & Yorumlar Yükleniyor… + Dallar & Etiketler Yükleniyor… @@ -77,7 +87,7 @@ Atanan Güncelleniyor… Sorun Güncelleniyor… Etiketler Güncelleniyor… - Kilometre Taşı Güncelleniyor… + Dönüm Noktası Güncelleniyor… GitHub @@ -123,22 +133,21 @@ Depolar Sorunlar Etiketleri Düzenle - Kilometre Taşı - Kilometre Taşı Düzenle + Dönüm Noktası + Dönüm Noktası Düzenle Atanan Düzenle Tanım Android Gist oluşturdu Başlık Düzenle - Yıldızla Gist Yıldızlanıyor… - Yıldızı Kaldır Gist\'in Yıldızı Kaldırılıyor… Hesaplar Atanmış Seç - Kilometre Taşı Seç + Dönüm Noktası Seç Etiket Seç - Kilometre Taşı Yok + Bir Dal Veya Etiket Seç + Dönüm Noktası Yok Kimse Atanmamış atanmış Hiç Gist bulunamadı @@ -157,7 +166,7 @@ Kapanmış Şu Kişiye Atanmış : Herhangi Biri - Kilometre Taşı: + Dönüm Noktası: Hiç Etiketler: Giriş yap @@ -171,6 +180,10 @@ Takip Ettikleri Takipçilerim Takip Ettiklerim + Takip Et + Takip Etmeyi Bırak + Yıldızlar + Yıldızı Kaldır Üyeler Sorun Kapatılıyor… Sorun Tekrar Açılıyor… @@ -187,7 +200,7 @@ Uygula Etiketler: Atanmış - Kilometre Taşı + Dönüm Noktası Etiketler Bu sorunu kapatmak istediğinizden emin misiniz? Bu sorunu tekrar açmak istediğinizden emin misiniz? @@ -215,5 +228,37 @@ {0} onay karşılaştırılıyor Sözcük Kaydır Sözcük Kaydırmayı Kapat + Kod + Takip Edilme İşlemi Devam Ediyor… + Takip Edilme Kaldırılıyor… + Yıldız Konuyor… + Yıldız Kaldırılıyor… + Yönlendiriliyor… + + + Depolar + Haberler + Takip Ettiklerim + Takip Edenler + Takip Ettikleri + Takip Edenler + Üyeler + Kod + Onaylamalar + Durumlar + İzlediklerim + Atandıklarım + Yaratılanlar + Bahsedilenler + Benim + Yıldızladıklarım + Hepsi + + Paylaş + Şifre Göster + Yaz + Önizleme + Ham markdown dosyasını göster + Markdown dosyasını renderla From 836de095c7ad3c177ea0e352b0f42ac7d54b4b2d Mon Sep 17 00:00:00 2001 From: Krishnakumar Pooloth Date: Wed, 27 Mar 2013 10:35:52 +0530 Subject: [PATCH 0175/1055] Remove unneeded casts and use String.contains() --- .../github/mobile/ui/issue/EditIssuesFilterActivity.java | 6 +++--- .../main/java/com/github/mobile/ui/issue/IssueFragment.java | 2 +- .../com/github/mobile/ui/ref/BranchFileViewActivity.java | 2 +- .../main/java/com/github/mobile/util/HttpImageGetter.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java b/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java index 1ad614f7e..65a2db386 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java @@ -137,7 +137,7 @@ public void onClick(View v) { } }; - ((TextView) findViewById(id.tv_assignee_label)) + findViewById(id.tv_assignee_label) .setOnClickListener(assigneeListener); assigneeText.setOnClickListener(assigneeListener); @@ -152,7 +152,7 @@ public void onClick(View v) { } }; - ((TextView) findViewById(id.tv_milestone_label)) + findViewById(id.tv_milestone_label) .setOnClickListener(milestoneListener); milestoneText.setOnClickListener(milestoneListener); @@ -167,7 +167,7 @@ public void onClick(View v) { } }; - ((TextView) findViewById(id.tv_labels_label)) + findViewById(id.tv_labels_label) .setOnClickListener(labelsListener); labelsText.setOnClickListener(labelsListener); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index 2fc6cd2ea..2cf0e51c1 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -270,7 +270,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) { labelsArea = (TextView) headerView.findViewById(id.tv_labels); milestoneArea = headerView.findViewById(id.ll_milestone); milestoneText = (TextView) headerView.findViewById(id.tv_milestone); - milestoneProgressArea = (View) headerView.findViewById(id.v_closed); + milestoneProgressArea = headerView.findViewById(id.v_closed); bodyText = (TextView) headerView.findViewById(id.tv_issue_body); bodyText.setMovementMethod(LinkMovementMethod.getInstance()); diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index e9d49b56a..bf4dcdc07 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -256,7 +256,7 @@ private void loadMarkdown() { Bundle args = new Bundle(); args.putCharSequence(ARG_TEXT, markdown); if (repo instanceof Serializable) - args.putSerializable(ARG_REPO, (Serializable) repo); + args.putSerializable(ARG_REPO, repo); getSupportLoaderManager().restartLoader(0, args, this); } diff --git a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java index 7994d484f..32177a096 100644 --- a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java +++ b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java @@ -70,7 +70,7 @@ public Drawable getDrawable(String source) { } private static boolean containsImages(final String html) { - return html.indexOf(" Date: Thu, 2 May 2013 09:00:52 -0700 Subject: [PATCH 0176/1055] Remove unneeded instanceof check Repository implements Serializable and does not need to be explicitly checked before inserting into the bundle. --- .../com/github/mobile/ui/commit/CommitFileViewActivity.java | 3 +-- .../java/com/github/mobile/ui/ref/BranchFileViewActivity.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java index a5999b731..033254db5 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java @@ -262,8 +262,7 @@ private void loadMarkdown() { EncodingUtils.fromBase64(blob.getContent())); Bundle args = new Bundle(); args.putCharSequence(ARG_TEXT, markdown); - if (repo instanceof Serializable) - args.putSerializable(ARG_REPO, (Serializable) repo); + args.putSerializable(ARG_REPO, repo); getSupportLoaderManager().restartLoader(0, args, this); } diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index bf4dcdc07..e90ad41ba 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -255,8 +255,7 @@ private void loadMarkdown() { EncodingUtils.fromBase64(blob.getContent())); Bundle args = new Bundle(); args.putCharSequence(ARG_TEXT, markdown); - if (repo instanceof Serializable) - args.putSerializable(ARG_REPO, repo); + args.putSerializable(ARG_REPO, repo); getSupportLoaderManager().restartLoader(0, args, this); } From b5cd7d109097be3acb6eff4e94a9b1cd1eb463a1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 May 2013 09:37:42 -0700 Subject: [PATCH 0177/1055] Always call setCurrentItem from updateCurrentItem Previously updateCurrentItem() was only called if pager.setItem() returned true which would not be the case when the pager was manually swiped since the position had already been set to the new value. Closes #352 --- app/src/main/java/com/github/mobile/ui/TabPagerActivity.java | 5 +++-- .../github/mobile/ui/comment/CommentPreviewPagerAdapter.java | 1 - .../com/github/mobile/ui/comment/CreateCommentActivity.java | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index 8b4cbe814..a6d34e625 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -136,9 +136,10 @@ protected int getContentView() { } private void updateCurrentItem(final int newPosition) { - if (newPosition > -1 && newPosition < adapter.getCount() - && pager.setItem(newPosition)) + if (newPosition > -1 && newPosition < adapter.getCount()) { + pager.setItem(newPosition); setCurrentItem(newPosition); + } } private void createPager() { diff --git a/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java b/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java index 821f36282..2a989ff54 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java @@ -16,7 +16,6 @@ package com.github.mobile.ui.comment; import android.support.v4.app.Fragment; - import com.actionbarsherlock.app.SherlockFragmentActivity; import com.github.mobile.ui.FragmentPagerAdapter; diff --git a/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java b/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java index 01b6317a7..a52d3a425 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java +++ b/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java @@ -61,7 +61,6 @@ public void invalidateOptionsMenu() { if (applyItem != null) applyItem.setEnabled(adapter != null && !TextUtils.isEmpty(adapter.getCommentText())); - } @Override From f9f76374b705831fcc495a0735149a8489655e3c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 May 2013 11:08:02 -0700 Subject: [PATCH 0178/1055] Remove full HTML when raw HTML value changes Previously the issue body html was not being re-encoded after edits and also the full html was never being flushed when the raw version has changed from the last time it was encoded. This would cause the issue description to not update after being edited. Closes #353 --- .../com/github/mobile/ui/issue/IssueFragment.java | 6 ++++-- .../java/com/github/mobile/util/HttpImageGetter.java | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index 2cf0e51c1..3b8e2e85c 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -500,7 +500,9 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case ISSUE_EDIT: - updateHeader((Issue) data.getSerializableExtra(EXTRA_ISSUE)); + Issue editedIssue = (Issue) data.getSerializableExtra(EXTRA_ISSUE); + bodyImageGetter.encode(editedIssue.getId(), editedIssue.getBodyHtml()); + updateHeader(editedIssue); return; case COMMENT_CREATE: Comment comment = (Comment) data @@ -557,4 +559,4 @@ public boolean onOptionsItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java index 32177a096..2b8e0ba77 100644 --- a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java +++ b/app/src/main/java/com/github/mobile/util/HttpImageGetter.java @@ -132,9 +132,13 @@ public HttpImageGetter encode(final Object id, final String html) { CharSequence encoded = HtmlUtils.encode(html, loading); // Use default encoding if no img tags - if (containsImages(html)) - rawHtmlCache.put(id, encoded); - else { + if (containsImages(html)) { + CharSequence currentEncoded = rawHtmlCache.put(id, encoded); + // Remove full html if raw html has changed + if (currentEncoded == null + || !currentEncoded.toString().equals(encoded.toString())) + fullHtmlCache.remove(id); + } else { rawHtmlCache.remove(id); fullHtmlCache.put(id, encoded); } @@ -184,7 +188,6 @@ protected CharSequence run(Account account) throws Exception { @Override protected void onSuccess(final CharSequence html) throws Exception { - rawHtmlCache.remove(id); fullHtmlCache.put(id, html); if (id.equals(view.getTag())) From 2decf4b3a120833c5da151b1a3ee79ee6a4e3a3e Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Wed, 15 May 2013 10:19:48 -0600 Subject: [PATCH 0179/1055] Fix Repository News long press Performing a long click on a repository news item and selecting one of the choices did nothing since: 1) The current repository is already being shown 2) There was no viewUser function defined for RepositoryNewsFragment --- .../mobile/ui/repo/RepositoryNewsFragment.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java index 346b70f2c..e4ea2f890 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java @@ -19,12 +19,15 @@ import android.app.Activity; import com.github.mobile.core.ResourcePager; +import com.github.mobile.core.user.UserEventMatcher.UserPair; import com.github.mobile.ui.NewsFragment; import com.github.mobile.ui.issue.IssuesViewActivity; import com.github.mobile.ui.user.EventPager; +import com.github.mobile.ui.user.UserViewActivity; import org.eclipse.egit.github.core.Issue; import org.eclipse.egit.github.core.Repository; +import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; import org.eclipse.egit.github.core.event.Event; @@ -68,4 +71,16 @@ protected void viewRepository(Repository repository) { protected void viewIssue(Issue issue, Repository repository) { startActivity(IssuesViewActivity.createIntent(issue, repo)); } + + @Override + protected boolean viewUser(User user) { + startActivity(UserViewActivity.createIntent(user)); + return true; + } + + @Override + protected void viewUser(UserPair users) { + if (!viewUser(users.from)) + viewUser(users.to); + } } From 79f226e94de2d6b6f8cba319148922f53c8b917a Mon Sep 17 00:00:00 2001 From: crazymaster Date: Wed, 22 May 2013 00:06:25 +0900 Subject: [PATCH 0180/1055] Fix Japanese translations Closes #365 --- app/res/values-ja/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/res/values-ja/strings.xml b/app/res/values-ja/strings.xml index dba35955c..1877bac1a 100644 --- a/app/res/values-ja/strings.xml +++ b/app/res/values-ja/strings.xml @@ -19,8 +19,8 @@ アカウントと組織名のロードに失敗しました イシューのロードに失敗しました - レポジトリのロードに失敗しました - レポジトリのロードに失敗しました + リポジトリのロードに失敗しました + リポジトリのロードに失敗しました Gist のロードに失敗しました ニュースのロードに失敗しました フォロワーのロードに失敗しました @@ -40,10 +40,10 @@ Gist をロードしています… ランダムな Gist をロードしています… - さらなるイシューをロードしています… + イシューをさらにロードしています… イシューをロードしています… コメントをロードしています… - レポジトリをロードしています… + リポジトリをロードしています… イシューをロードしています… ニュースをロードしています… フォロワーをロードしています… @@ -57,7 +57,7 @@ ブックマークはありません - レポジトリはありません + リポジトリはありません イシューはありません Gists はありません 人物はいません @@ -78,7 +78,7 @@ ニュース イシュー Gists - レポジトリを検索 + リポジトリを検索 イシューを検索 検索… 履歴を消去 @@ -112,7 +112,7 @@ コメント作成 コメントを入力して下さい さらに表示… - レポジトリ + リポジトリ イシュー ラベルを編集 マイルストーン: @@ -131,8 +131,8 @@ マイルストーンを選択 ラベルを選択 マイルストーンはありません - 参加者はいません - が参加しています + 管理者はいません + に割り当てられています Gists は見つかりませんでした 削除の確認 本当にこの Gist を削除してもよろしいですか? From 823cde1173a2c2889c7399341625d6d6574e4b7a Mon Sep 17 00:00:00 2001 From: kmav Date: Wed, 15 May 2013 02:54:21 +0300 Subject: [PATCH 0181/1055] Add Greek translation Closes #363 --- app/res/values-el/strings.xml | 264 ++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 app/res/values-el/strings.xml diff --git a/app/res/values-el/strings.xml b/app/res/values-el/strings.xml new file mode 100644 index 000000000..988d88dad --- /dev/null +++ b/app/res/values-el/strings.xml @@ -0,0 +1,264 @@ + + + + + + Η φόρτωση λογαριασμού & οργανισμών απέτυχε + Η φόρτωση ζητημάτων απέτυχε + Η φόρτωση αποθετηρίων απέτυχε + Η φόρτωση αποθετηρίου απέτυχε + Η φόρτωση Gist απέτυχε + Η φόρτωση Νέων απέτυχε + Η φόρτωση Ακόλουθων απέτυχε + Η φόρτωση κόσμου απέτυχε + Η φόρτωση προσώπου απέτυχε + Η φόρτωση του περιεχομένου του αρχείου Gist απέτυχε + Η φόρτωση Gists απέτυχε + Η φόρτωση ζητήματος απέτυχε + Η φόρτωση συνεργατών απέτυχε + Η φόρτωση οροσήμων απέτυχε + Η φόρτωση labels απέτυχε + Η φόρτωση σελιδοδεικτών απέτυχε + Η φόρτωση μελών απέτυχε + Η φόρτωση υποβολών απέτυχε + Η φόρτωση υποβολής απέτυχε + Η φόρτωση αρχείου απέτυχε + Η φόρτωση κώδικα απέτυχε + Η φόρτωση κλάδων & ετικετών απέτυχε + Η ακολούθηση απέτυχε + Η αναίρεση ακολούθησης απέτυχε + Ο έλεγχος κατάστασης ακολούθησης απέτυχε + Η επισήμανση απέτυχε + Η αναίρεση επισήμανσης απέτυχε + Ο έλεγχος κατάστασης επισήμανσης απέτυχε + Η απόδοση περιεχομένου markdown απέτυχε + + + + + Φορτώνεται Gist… + Φορτώνεται Τυχαίο Gist… + Φορτώνονται Περισσότερα Ζητήματα… + Φορτώνονται Ζητήματα… + Φορτώνονται Σχόλια… + Φορτώνονται Αποθετήρια… + Φορτώνεται Ζήτημα… + Φορτώνονται Νέα… + Φορτώνονται Ακολούθοι… + Φορτώνονται Άνθρωποι… + Φορτώνονται Gists… + Φορτώνονται Συνεργάτες… + Φορτώνονται Ορόσημα… + Φορτώνονται Labels… + Φορτώνονται Υποβολές… + Φορτώνονται Αρχεία & και Σχόλια… + Φορτώνονται Κλάδοι & Tags… + + + + + Δεν υπάρχουν Σελιδοδείκτες + Δεν υπάρχουν Αποθετήρια + Δεν υπάρχουν Ζητήματα + Δεν υπάρχουν Gists + Δεν υπάρχουν Άνθρωποι + Δεν υπάρχουν Ακόλουθοι + Δεν υπάρχουν Μέλη + Δεν υπάρχουν Νέα + Δεν υπάρχουν Υποβολές + + + + + Ενημέρωση Εντολοδόχου… + Ενημέρωση Ζητήματος… + Ενημέρωση Ετικετών… + Ενημέρωση Οροσήμου… + + + GitHub + Νέα + Ζητήματα + Gists + Υποβολές + Εύρεση Αποθετηρίων + Εύρεση Ζητημάτων + Εύρεση… + Εkκαθάριση Ιστορικού + Καθαρίστηκε το ιστορικό αναζήτησης + Γίνεται είσοδος… + Δημιουργείται Gist… + Δημιουργία + Δημιουργία Gist + τυπώνει \'Hello World!\' + Κάνε αυτό το Gist δημόσιο + file.rb + Gist + Σχόλια + Αρχεία + Άνοιξε + Τυχαία + Όνομα Αρχείου + Περιεχόμενο Αρχείου + Νέο Gist + Φίλτρο + Σελιδοδείκτης + Σχόλιο + Διάγραψε + Ανανέωσε + Πίνακας Ζητημάτων + Σελιδοδείκτες + Gists + Ζήτημα # + Αίτηση Εξαγωγής # + Gist\u0020 + Φίλτραρε Ζητήματα + Δημιούργησε Σχόλιο + Εισάγαγε σχόλιο + Εμφάνισε περισσότερα… + Αποθετήρια + Ζητήματα + Διόρθωσε Ετικέτες + Ορόσημο: + Διόρθωσε Ορόσημο + Διόρθωσε Εντολοδόχο + Περιγραφή + Gist δημιουργημένο από Android + Τίτλος + Διόρθωσε + Επισήμανε Gist… + Αφαίρεσε επισήμανση από Gist… + Λογαριασμοί + Επέλεξε Εντολοδόχο + Επέλεξε Ορόσημο + Επέλεξε Ετικέτες + Επέλεξε Κλάδο ή Tag + Δεν βρέθηκε ορόσημο + Κανείς δεν είναι εντολοδόχος + έχει γίνει εντολοδόχος + Δεν βρέθηκαν Gists + Επιβεβαιώστε Διαγραφή + Είστε σίγουρη-ος για τη διαγραφή του Gist? + Διαγράφεται Gist… + Δημιουργείται σχόλιο… + Είστε σίγουρη-ος για τη διαγραφή του Σελιδοδείκτη? + Πίνακας Ζητημάτων + Νέο Ζήτημα + Ανώνυμος + Το φίλτρο ζητημάτων αποθηκεύτηκε στους σελιδοδείκτες + Πρόσφατα + Κατάσταση: + Ανοικτή + Κλειστή + Έχει Ανατεθεί σε: + Οποιοσδήποτε + Ορόσημο: + Κανείς + Ετικέτες: + Είσοδος + Νέα/ος στο GitHub? <a href=\"https://github.com/plans\">Πατήστε εδώ</a> για είσοδο + Αδυναμία σύνδεσης στο GitHub + Παρακαλούμε εισάγετε έγκυρο όνομα χρήστη & συνθηματικό + Παρακαλούμε εισάγετε έγκυρο συνθηματικό. + Συνθηματικό + Όνομα ή Email + Ακόλουθοι + Ακολουθούν + Ακόλουθοι + Ακολουθώ + Ακολουθώ + Αποχωρώ + Επισήμανση + Αποσήμανση + Μέλη + Κλείσιμο ζητήματος… + Ξανάνοιγμα ζητήματος… + Avatar + Δημιουργείται Ζήτημα… + δημιουργήθηκε\u0020 + ενημερώθηκε\u0020 + άνοιξε\u0020 + Καθάρισε + Ανοικτά Ζητήματα + Κλειστά Ζητήματα + Αφαίρεσε Σελιδοδείκτη + Σώσε + Εφάρμοσε + Ετικέτες: + Εντολοδόχοι + Ορόσημο + Ετικέτες + Είστε σίγουρη-ος ότι θέλετε να κλείσετε αυτό το ζήτημα? + Είστε σίγουρη-ος ότι θέλετε να ξανανοίξετε αυτό το ζήτημα? + Κλείστε Ζήτημα + Ξανανοίξτε Ζήτημα + Κλειστή + Δεν δόθηκε περιγραφή. + Κλείσε + Ξανάνοιξε + Άκυρο GitHub URL + Το ακόλουθο URL δεν μπορεί να ανοίξει από αυτή την εφαρμογή:\n{0} + ΠΡΟΣΦΑΤΑ ΑΝΑΓΝΩΣΜΕΝΑ + Ακύρωση + Σύγκρουση εφαρμογών + Και άλλη εγκατ. εφαρμογή είναι ήδη ρυθμισμένη για αυθεντικοποίηση GitHub.\n\nΘα πρέπει να αφαιρέσετε την άλλη εφαρμογή από τις ρυθμίσεις Λογαριασμών & συγχρονισμού και να την απεγκαταστήσετε πριν να χρησιμοποιηθεί η εφαρμογή GitHub. + Ανοίγει {0}… + Σύγκριση Υποβολής + Υποβολή\u0020 + Γονέας\u0020 + εξουσιοδότημένος + υποβλήθηκε + Τί θέλετε να κάνετε? + Σχολιάστε στη γραμμή + Δείτε όλο το αρχείο + Συγκρίνονται {0} υποβολές + Ενεργοποίησε επικάλυψη + Απενεργοποίησε επικάλυψη + Κώδικας + Ακολούθηση… + Απο-Ακολούθηση… + Επισήμανση… + Αποσήμανση… + Πλοήγηση σε… + + + αποθετήρια + νέα + ακολούθηση + ακόλουθοι + ακολούθηση + ακόλουθοι + μέλη + κώδικας + υποβολές + ζητήματα + αναγνώσεις + αναθέσεις + δημιουργίες + αναφορές + προσωπικά + επισημασμένα + όλα + + Μοίρασε + Εμφάνισε συνθηματικό + Γράψε + Προεπισκόπηση + Εμφάνισε απλή markdown + Απόδοσε markdown + + From 6db1a5295ab3767502058380174e37fe0d03ea86 Mon Sep 17 00:00:00 2001 From: crazymaster Date: Sat, 15 Jun 2013 14:34:51 +0900 Subject: [PATCH 0182/1055] Fix Travic CI configuration Closes #379 --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 11566ed01..688e53d2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,14 @@ language: java +jdk: oraclejdk7 notifications: email: false before_install: - - wget http://dl.google.com/android/android-sdk_r21-linux.tgz - - tar -zxf android-sdk_r21-linux.tgz - - export ANDROID_HOME=~/builds/github/android/android-sdk-linux - - export PATH=${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH} - - android update sdk --filter platform-tools,android-16 --no-ui --force \ No newline at end of file + - sudo apt-get update -qq + - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi + - wget http://dl.google.com/android/android-sdk_r21.1-linux.tgz + - tar -zxf android-sdk_r21.1-linux.tgz + - export ANDROID_HOME=$PWD/android-sdk-linux + - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools + - android update sdk --filter platform-tools,android-16 --no-ui --force > /dev/null From 2a9f064766dffc229bbd17987f3a1919f08aa313 Mon Sep 17 00:00:00 2001 From: PetiPandaRou Date: Mon, 6 May 2013 22:14:55 +0200 Subject: [PATCH 0183/1055] Correct error in French translation Closes #359 --- app/res/values-fr/strings.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/res/values-fr/strings.xml b/app/res/values-fr/strings.xml index e7fa3904b..1dc3b4095 100644 --- a/app/res/values-fr/strings.xml +++ b/app/res/values-fr/strings.xml @@ -104,9 +104,9 @@ Création d\'un Gist… Créer Créer un Gist - puts \'Hello World!\' + \'Hello World!\' Rendre ce Gist public - file.rb + fichier.rb Gist Commentaires Fichiers @@ -129,7 +129,7 @@ Filtrer les tickets Ajouter un commentaire Entrer un commentaire - Affichier plus… + Afficher plus… Dépôts Tickets Modifier les libellés @@ -146,7 +146,7 @@ Sélectionner l\'assigné Sélectionner le jalon Sélectionner les libellés - Sélectionner branche ou tag + Sélectionner une branche ou un tag Aucun jalon Personne n\'est assigné est assigné @@ -172,8 +172,8 @@ Se connecter Nouveau sur GitHub\u00a0? <a href=\"https://github.com/plans\">Cliquez ici</a> pour vous inscrire Impossible de se connecter à GitHub - Veuillez entrer un login et mot de passe valides - Veuillez entrer un mot de passe valide. + Veuillez entrer un login et un mot de passe valides + Veuillez entrer un mot de passe valide Mot de passe Login ou Email Abonnés @@ -222,7 +222,7 @@ Parent\u0020 auteur committé - Que voulez-vous faire? + Que voulez-vous faire\u00a0? Commenter la ligne Voir fichier complet Comparaison {0} commits @@ -231,12 +231,12 @@ Code Abonnement… Désabonnement… - Ajout aux favrois… + Ajout aux favoris… Supprimer des favoris… Aller à… - - repositories + + dépôts nouvelles abonnements abonnés @@ -256,7 +256,7 @@ Partager Voir mot de passe - Ecrire + Écrire Pré-visualiser Afficher la syntaxe markdown Afficher le rendu markdown From ebb4c2fd58bafae69d92c4093352cd5d6c281363 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Sat, 15 Jun 2013 20:40:46 -0700 Subject: [PATCH 0184/1055] Remove Ruby snippet from French translation --- app/res/values-fr/strings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/res/values-fr/strings.xml b/app/res/values-fr/strings.xml index 1dc3b4095..c0c01be8d 100644 --- a/app/res/values-fr/strings.xml +++ b/app/res/values-fr/strings.xml @@ -104,7 +104,6 @@ Création d\'un Gist… Créer Créer un Gist - \'Hello World!\' Rendre ce Gist public fichier.rb Gist From 02c2ef54e6014e2fae50fb91ceab9f001091637c Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Sat, 22 Jun 2013 01:05:56 +0300 Subject: [PATCH 0185/1055] Don't open new activity when viewing an owner of the repo (this can cause issues with deep hierarchy by opening user->user's repo->same user and so on) --- .../com/github/mobile/ui/repo/RepositoryNewsFragment.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java index e4ea2f890..e0bc79138 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java @@ -74,8 +74,11 @@ protected void viewIssue(Issue issue, Repository repository) { @Override protected boolean viewUser(User user) { - startActivity(UserViewActivity.createIntent(user)); - return true; + if (repo.getOwner().getId() != user.getId()) { + startActivity(UserViewActivity.createIntent(user)); + return true; + } + return false; } @Override From b7c3de056fef7ce8a6287e0a401aec47115945e6 Mon Sep 17 00:00:00 2001 From: Robert Buonpastore Date: Sun, 23 Jun 2013 23:06:26 -0400 Subject: [PATCH 0186/1055] Fix build process for Android 22 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ea09508a..ce4b9b46b 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ com.jayway.maven.plugins.android.generation2 android-maven-plugin - 3.5.3 + 3.6.0 true From ba2cd419cbd4e05ab94aa28b04d880ffa6b7e362 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 27 Jun 2013 12:48:22 -0700 Subject: [PATCH 0187/1055] Update RoboGuice link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3153c91cb..f7ae2b1d7 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ It also uses many other open source libraries such as: * [ActionBarSherlock](https://github.com/JakeWharton/ActionBarSherlock) * [ViewPagerIndicator](https://github.com/JakeWharton/Android-ViewPagerIndicator) -* [RoboGuice](http://code.google.com/p/roboguice/) +* [RoboGuice](https://github.com/roboguice/roboguice) * [android-maven-plugin](https://github.com/jayway/maven-android-plugin) * [CodeMirror](https://github.com/marijnh/CodeMirror) From 00f59684e6a4f800d392d9fd354341851adf688f Mon Sep 17 00:00:00 2001 From: "Jose M. Chumo Mata" Date: Sun, 30 Jun 2013 14:11:05 +0200 Subject: [PATCH 0188/1055] Update spanish translation Closes #383 --- app/res/values-es/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/res/values-es/strings.xml b/app/res/values-es/strings.xml index 698a4f13c..303fa1bc0 100644 --- a/app/res/values-es/strings.xml +++ b/app/res/values-es/strings.xml @@ -233,6 +233,7 @@ Dejando de seguir… Marcando como destacado… Desmarcando como destacado… + Ir a… repositorios @@ -257,5 +258,7 @@ Mostrar contraseña Escribir Vista previa + Mostrar markdown + Procesar markdown From 6d3b47292621a967ee2c7aedea664a9fbef167a2 Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Fri, 19 Apr 2013 04:11:21 -0600 Subject: [PATCH 0189/1055] Long click on repo opens dialog 1) Navigate to repo owner's page 2) Remove repository from Recently Viewed Also now refreshes repositories list when you return from viewing a repo if the repo was added to the Recently Viewed list. Previously, you had to manually refresh for the change to be seen. Closes #348 --- app/res/layout/repo_dialog.xml | 90 +++++++++++++++++++ app/res/values/strings.xml | 4 +- .../mobile/ui/DialogFragmentHelper.java | 2 +- .../mobile/ui/repo/RecentRepositories.java | 23 +++++ .../ui/repo/RepositoryListFragment.java | 83 +++++++++++++++-- .../ui/repo/RepositoryViewActivity.java | 3 + .../com/github/mobile/util/AvatarLoader.java | 2 +- 7 files changed, 197 insertions(+), 10 deletions(-) create mode 100644 app/res/layout/repo_dialog.xml diff --git a/app/res/layout/repo_dialog.xml b/app/res/layout/repo_dialog.xml new file mode 100644 index 000000000..87db69375 --- /dev/null +++ b/app/res/layout/repo_dialog.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index 5af21de29..31940f0ce 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -160,7 +160,10 @@ New Issue Anonymous Issue filter saved to bookmarks + RECENTLY VIEWED Recent + Remove Recent + Remove from recently used Status: Open Closed @@ -212,7 +215,6 @@ Reopen Invalid GitHub URL The following URL could not be opened by this application:\n{0} - RECENTLY VIEWED Cancel App Conflict Another installed app is already configured for GitHub authentication.\n\nYou must remove the other app from the Accounts & sync settings and uninstall it before the GitHub app can be used. diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java b/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java index 6de6a07be..8443197b2 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java @@ -111,7 +111,7 @@ protected String getTitle() { /** * Get message * - * @return mesage + * @return message */ protected String getMessage() { return getArguments().getString(ARG_MESSAGE); diff --git a/app/src/main/java/com/github/mobile/ui/repo/RecentRepositories.java b/app/src/main/java/com/github/mobile/ui/repo/RecentRepositories.java index 9659af138..6e0c94add 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RecentRepositories.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RecentRepositories.java @@ -108,6 +108,29 @@ public RecentRepositories add(final long id) { return this; } + /** + * Remove repository from recent list + * + * @param repo + * @return this recent list + */ + public RecentRepositories remove(final Repository repo) { + return repo != null ? remove(repo.getId()) : this; + } + + /** + * Remove id from recent list + * + * @param id + * @return this recent list + */ + public RecentRepositories remove(final long id) { + if (ids == null) + load(); + ids.remove(id); + return this; + } + /** * Persist recent list asynchronously on a background thread * diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java index 90861f1f7..cd16db3b0 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java @@ -19,30 +19,39 @@ import static com.github.mobile.RequestCodes.REPOSITORY_VIEW; import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; import static java.util.Locale.US; + +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +import org.eclipse.egit.github.core.Repository; +import org.eclipse.egit.github.core.User; + import android.app.Activity; +import android.app.AlertDialog; import android.content.Intent; import android.os.Bundle; import android.support.v4.content.Loader; import android.view.View; +import android.view.View.OnClickListener; import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; +import com.github.kevinsawicki.wishlist.ViewFinder; +import com.github.mobile.R.id; +import com.github.mobile.R.layout; import com.github.mobile.R.string; import com.github.mobile.ThrowableLoader; import com.github.mobile.persistence.AccountDataManager; import com.github.mobile.ui.HeaderFooterListAdapter; import com.github.mobile.ui.ItemListFragment; +import com.github.mobile.ui.LightAlertDialog; import com.github.mobile.ui.user.OrganizationSelectionListener; import com.github.mobile.ui.user.OrganizationSelectionProvider; +import com.github.mobile.ui.user.UserViewActivity; +import com.github.mobile.util.AvatarLoader; import com.google.inject.Inject; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; - -import org.eclipse.egit.github.core.Repository; -import org.eclipse.egit.github.core.User; - /** * Fragment to display a list of {@link Repository} instances */ @@ -52,6 +61,9 @@ public class RepositoryListFragment extends ItemListFragment @Inject private AccountDataManager cache; + @Inject + private AvatarLoader avatars; + private final AtomicReference org = new AtomicReference(); private RecentRepositories recentRepos; @@ -119,6 +131,7 @@ public void onActivityCreated(Bundle savedInstanceState) { @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { + // Refresh if the viewed repository was (un)starred if (requestCode == REPOSITORY_VIEW && resultCode == RESOURCE_CHANGED) { forceRefresh(); return; @@ -132,10 +145,66 @@ public void onListItemClick(ListView list, View v, int position, long id) { Repository repo = (Repository) list.getItemAtPosition(position); if (recentRepos != null) recentRepos.add(repo); + startActivityForResult(RepositoryViewActivity.createIntent(repo), REPOSITORY_VIEW); } + @Override + public boolean onListItemLongClick(ListView list, View v, int position, + long itemId) { + if (!isUsable()) + return false; + + final Repository repo = (Repository) list.getItemAtPosition(position); + if (repo == null) + return false; + + final AlertDialog dialog = LightAlertDialog.create(getActivity()); + dialog.setCanceledOnTouchOutside(true); + + dialog.setTitle(repo.generateId()); + + View view = getActivity().getLayoutInflater().inflate( + layout.repo_dialog, null); + ViewFinder finder = new ViewFinder(view); + + final User owner = repo.getOwner(); + avatars.bind(finder.imageView(id.iv_owner_avatar), owner); + finder.setText(id.tv_owner_name, "Navigate to " + owner.getLogin()); + finder.onClick(id.ll_owner_area, new OnClickListener() { + + public void onClick(View v) { + dialog.dismiss(); + + viewUser(owner); + } + }); + + if ((recentRepos != null) && (recentRepos.contains(repo))) { + finder.find(id.ll_recent_repo_area_vis).setVisibility(View.VISIBLE); + finder.onClick(id.ll_recent_repo_area, new OnClickListener() { + + public void onClick(View v) { + dialog.dismiss(); + + recentRepos.remove(repo); + refresh(); + } + }); + } + + dialog.setView(view); + dialog.show(); + + return true; + } + + private void viewUser(User user) { + if (org.get().getId() != user.getId()) + startActivity(UserViewActivity.createIntent(user)); + } + @Override public void onStop() { super.onStop(); diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index c5b1306f5..9045a5313 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -177,6 +177,9 @@ public boolean onOptionsItemSelected(MenuItem item) { case id.m_share: shareRepository(); return true; + case id.m_refresh: + checkStarredRepositoryStatus(); + return super.onOptionsItemSelected(item); case android.R.id.home: finish(); Intent intent = new Intent(this, HomeActivity.class); diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/mobile/util/AvatarLoader.java index 7d704cb68..179d1ffe4 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/mobile/util/AvatarLoader.java @@ -395,7 +395,6 @@ public AvatarLoader bind(final ImageView view, final CommitUser user) { return setImage(loadingAvatar, view); String avatarUrl = getAvatarUrl(user); - if (TextUtils.isEmpty(avatarUrl)) return setImage(loadingAvatar, view); @@ -408,6 +407,7 @@ public AvatarLoader bind(final ImageView view, final CommitUser user) { setImage(loadingAvatar, view, userId); final String loadUrl = avatarUrl; + new FetchAvatarTask(context) { @Override From 8fcb44b6f296818eef72356c173b28a511f98476 Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Tue, 30 Apr 2013 12:52:41 -0600 Subject: [PATCH 0190/1055] Revert AvatarLoader whitespace changes --- app/src/main/java/com/github/mobile/util/AvatarLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/mobile/util/AvatarLoader.java index 179d1ffe4..7d704cb68 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/mobile/util/AvatarLoader.java @@ -395,6 +395,7 @@ public AvatarLoader bind(final ImageView view, final CommitUser user) { return setImage(loadingAvatar, view); String avatarUrl = getAvatarUrl(user); + if (TextUtils.isEmpty(avatarUrl)) return setImage(loadingAvatar, view); @@ -407,7 +408,6 @@ public AvatarLoader bind(final ImageView view, final CommitUser user) { setImage(loadingAvatar, view, userId); final String loadUrl = avatarUrl; - new FetchAvatarTask(context) { @Override From 8ab9683d0f216e0a555dfbd5345844f1f1def185 Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Sun, 7 Jul 2013 18:52:35 +0300 Subject: [PATCH 0191/1055] correct content description for avatar image --- app/res/layout/repo_dialog.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/res/layout/repo_dialog.xml b/app/res/layout/repo_dialog.xml index 87db69375..fd4df2ffc 100644 --- a/app/res/layout/repo_dialog.xml +++ b/app/res/layout/repo_dialog.xml @@ -36,7 +36,7 @@ + android:contentDescription="@string/avatar" /> Date: Sun, 7 Jul 2013 19:39:36 +0300 Subject: [PATCH 0192/1055] remove useless layout --- app/res/layout/repo_dialog.xml | 52 +++++++++---------- .../ui/repo/RepositoryListFragment.java | 3 +- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/app/res/layout/repo_dialog.xml b/app/res/layout/repo_dialog.xml index fd4df2ffc..9bf0e5c32 100644 --- a/app/res/layout/repo_dialog.xml +++ b/app/res/layout/repo_dialog.xml @@ -49,41 +49,37 @@ android:textStyle="normal" /> + + - + - - - - - - + android:includeFontPadding="true" + android:maxLines="2" + android:paddingBottom="0dp" + android:paddingLeft="10dp" + android:textStyle="normal" /> diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java index cd16db3b0..d709e1513 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java @@ -182,7 +182,8 @@ public void onClick(View v) { }); if ((recentRepos != null) && (recentRepos.contains(repo))) { - finder.find(id.ll_recent_repo_area_vis).setVisibility(View.VISIBLE); + finder.find(id.divider).setVisibility(View.VISIBLE); + finder.find(id.ll_recent_repo_area).setVisibility(View.VISIBLE); finder.onClick(id.ll_recent_repo_area, new OnClickListener() { public void onClick(View v) { From ac9542742cefd307ad96a8d3fee67481c31dc4c7 Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Mon, 8 Jul 2013 11:22:51 +0300 Subject: [PATCH 0193/1055] imports optimize --- .../mobile/ui/repo/RepositoryListFragment.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java index d709e1513..70c2af151 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java @@ -19,14 +19,6 @@ import static com.github.mobile.RequestCodes.REPOSITORY_VIEW; import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; import static java.util.Locale.US; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; - -import org.eclipse.egit.github.core.Repository; -import org.eclipse.egit.github.core.User; - import android.app.Activity; import android.app.AlertDialog; import android.content.Intent; @@ -52,6 +44,13 @@ import com.github.mobile.util.AvatarLoader; import com.google.inject.Inject; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +import org.eclipse.egit.github.core.Repository; +import org.eclipse.egit.github.core.User; + /** * Fragment to display a list of {@link Repository} instances */ From 672b331ca8d2b8a9af651ccacf519df8bf0fe37f Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Mon, 8 Jul 2013 11:49:58 +0300 Subject: [PATCH 0194/1055] extract string to resources --- app/res/values/strings.xml | 1 + .../java/com/github/mobile/ui/repo/RepositoryListFragment.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index 31940f0ce..f93b08c87 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -236,6 +236,7 @@ Starring… Unstarring… Navigate to… + Navigate to %s repositories diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java index 70c2af151..c92cd1785 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java @@ -170,7 +170,7 @@ public boolean onListItemLongClick(ListView list, View v, int position, final User owner = repo.getOwner(); avatars.bind(finder.imageView(id.iv_owner_avatar), owner); - finder.setText(id.tv_owner_name, "Navigate to " + owner.getLogin()); + finder.setText(id.tv_owner_name, getString(string.navigate_to_user, owner.getLogin())); finder.onClick(id.ll_owner_area, new OnClickListener() { public void onClick(View v) { From 4985820a301f62e27141d747178a4ab243c7a640 Mon Sep 17 00:00:00 2001 From: justinmuller Date: Mon, 8 Jul 2013 23:44:50 -0600 Subject: [PATCH 0195/1055] Extract duplicate code to single method. --- .../com/github/mobile/util/AvatarLoader.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/mobile/util/AvatarLoader.java index 7d704cb68..77b452052 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/mobile/util/AvatarLoader.java @@ -128,18 +128,7 @@ public AvatarLoader(final Context context) { * @return image */ protected BitmapDrawable getImage(final String userId) { - File avatarFile = new File(avatarDir, userId); - - if (!avatarFile.exists() || avatarFile.length() == 0) - return null; - - Bitmap bitmap = decode(avatarFile); - if (bitmap != null) - return new BitmapDrawable(context.getResources(), bitmap); - else { - avatarFile.delete(); - return null; - } + return getImageBy(userId); } /** @@ -149,7 +138,11 @@ protected BitmapDrawable getImage(final String userId) { * @return image */ protected BitmapDrawable getImage(final CommitUser user) { - File avatarFile = new File(avatarDir, user.getEmail()); + return getImageBy(user.getEmail()); + } + + private BitmapDrawable getImageBy(String filename) { + File avatarFile = new File(avatarDir, filename); if (!avatarFile.exists() || avatarFile.length() == 0) return null; From 6b0bd6c03b944c746f54317ddfaadda6f7faec73 Mon Sep 17 00:00:00 2001 From: justinmuller Date: Mon, 8 Jul 2013 23:49:02 -0600 Subject: [PATCH 0196/1055] Reduce scope of methods. Closes #384 --- app/src/main/java/com/github/mobile/util/AvatarLoader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/mobile/util/AvatarLoader.java index 77b452052..71c6b49cc 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/mobile/util/AvatarLoader.java @@ -127,7 +127,7 @@ public AvatarLoader(final Context context) { * @param userId * @return image */ - protected BitmapDrawable getImage(final String userId) { + private BitmapDrawable getImage(final String userId) { return getImageBy(userId); } @@ -137,7 +137,7 @@ protected BitmapDrawable getImage(final String userId) { * @param user * @return image */ - protected BitmapDrawable getImage(final CommitUser user) { + private BitmapDrawable getImage(final CommitUser user) { return getImageBy(user.getEmail()); } @@ -162,7 +162,7 @@ private BitmapDrawable getImageBy(String filename) { * @param file * @return bitmap */ - protected Bitmap decode(final File file) { + private Bitmap decode(final File file) { return BitmapFactory.decodeFile(file.getAbsolutePath(), options); } From 148ebdb9cf4b25661c743bd9866e37ecf62ad644 Mon Sep 17 00:00:00 2001 From: grivos Date: Tue, 29 Jan 2013 00:31:45 +0200 Subject: [PATCH 0197/1055] Change up navigation from RepositoryViewActivity Navigate to the owner's page instead of the HomeActivity Closes #316, closes #278 --- .../com/github/mobile/ui/repo/RepositoryViewActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java index 9045a5313..672dabf15 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java @@ -45,7 +45,7 @@ import com.github.mobile.core.repo.StarredRepositoryTask; import com.github.mobile.core.repo.UnstarRepositoryTask; import com.github.mobile.ui.TabPagerActivity; -import com.github.mobile.ui.user.HomeActivity; +import com.github.mobile.ui.user.UserViewActivity; import com.github.mobile.util.AvatarLoader; import com.github.mobile.util.ToastUtils; import com.google.inject.Inject; @@ -182,7 +182,7 @@ public boolean onOptionsItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); case android.R.id.home: finish(); - Intent intent = new Intent(this, HomeActivity.class); + Intent intent = UserViewActivity.createIntent(repository.getOwner()); intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent); return true; From e368f9c766012bf316581c3a22e23d101a206977 Mon Sep 17 00:00:00 2001 From: crazymaster Date: Sat, 13 Jul 2013 00:15:30 +0900 Subject: [PATCH 0198/1055] Improve Japanese translation Closes #385 --- app/res/values-ja/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/res/values-ja/strings.xml b/app/res/values-ja/strings.xml index 1877bac1a..2e45b881e 100644 --- a/app/res/values-ja/strings.xml +++ b/app/res/values-ja/strings.xml @@ -172,8 +172,8 @@ 更新\u0020 編集\u0020 消去 - イシューを開く - イシューを閉じる + 開いているイシュー + 閉じられたイシュー ブックマークを削除 保存 適用 From 3e22955e04d3bacc31bb5367de9cc67188fdf05d Mon Sep 17 00:00:00 2001 From: justinmuller Date: Mon, 15 Jul 2013 19:59:46 -0600 Subject: [PATCH 0199/1055] Remove duplication of methods in AvatarLoader, minor cleanup. --- .../com/github/mobile/util/AvatarLoader.java | 68 ++++--------------- 1 file changed, 15 insertions(+), 53 deletions(-) diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/mobile/util/AvatarLoader.java index 71c6b49cc..618e1805c 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/mobile/util/AvatarLoader.java @@ -124,23 +124,9 @@ public AvatarLoader(final Context context) { /** * Get image for user * - * @param userId + * @param filename * @return image */ - private BitmapDrawable getImage(final String userId) { - return getImageBy(userId); - } - - /** - * Get image for user - * - * @param user - * @return image - */ - private BitmapDrawable getImage(final CommitUser user) { - return getImageBy(user.getEmail()); - } - private BitmapDrawable getImageBy(String filename) { File avatarFile = new File(avatarDir, filename); @@ -258,7 +244,7 @@ public AvatarLoader bind(final ActionBar actionBar, @Override public BitmapDrawable call() throws Exception { - final BitmapDrawable image = getImage(userId); + final BitmapDrawable image = getImageBy(userId); if (image != null) return image; else @@ -336,7 +322,7 @@ public AvatarLoader bind(final ImageView view, final User user) { if (userId == null) return setImage(loadingAvatar, view); - String avatarUrl = getAvatarUrl(user); + final String avatarUrl = getAvatarUrl(user); if (TextUtils.isEmpty(avatarUrl)) return setImage(loadingAvatar, view); @@ -345,33 +331,7 @@ public AvatarLoader bind(final ImageView view, final User user) { return setImage(loadedImage, view); setImage(loadingAvatar, view, userId); - - final String loadUrl = avatarUrl; - new FetchAvatarTask(context) { - - @Override - public BitmapDrawable call() throws Exception { - if (!userId.equals(view.getTag(id.iv_avatar))) - return null; - - final BitmapDrawable image = getImage(userId); - if (image != null) - return image; - else - return fetchAvatar(loadUrl, userId); - } - - @Override - protected void onSuccess(final BitmapDrawable image) - throws Exception { - if (image == null) - return; - loaded.put(userId, image); - if (userId.equals(view.getTag(id.iv_avatar))) - setImage(image, view); - } - - }.execute(); + fetchAvatarTask(avatarUrl, userId, view).execute(); return this; } @@ -387,7 +347,7 @@ public AvatarLoader bind(final ImageView view, final CommitUser user) { if (user == null) return setImage(loadingAvatar, view); - String avatarUrl = getAvatarUrl(user); + final String avatarUrl = getAvatarUrl(user); if (TextUtils.isEmpty(avatarUrl)) return setImage(loadingAvatar, view); @@ -399,20 +359,25 @@ public AvatarLoader bind(final ImageView view, final CommitUser user) { return setImage(loadedImage, view); setImage(loadingAvatar, view, userId); + fetchAvatarTask(avatarUrl, userId, view).execute(); - final String loadUrl = avatarUrl; - new FetchAvatarTask(context) { + return this; + } + + private FetchAvatarTask fetchAvatarTask(final String avatarUrl, + final String userId, final ImageView view) { + return new FetchAvatarTask(context) { @Override public BitmapDrawable call() throws Exception { if (!userId.equals(view.getTag(id.iv_avatar))) return null; - final BitmapDrawable image = getImage(user); + final BitmapDrawable image = getImageBy(userId); if (image != null) return image; else - return fetchAvatar(loadUrl, userId); + return fetchAvatar(avatarUrl, userId); } @Override @@ -424,9 +389,6 @@ protected void onSuccess(final BitmapDrawable image) if (userId.equals(view.getTag(id.iv_avatar))) setImage(image, view); } - - }.execute(); - - return this; + }; } } From a4a4c7885b755a0779b7b157b75ca5360cae3b49 Mon Sep 17 00:00:00 2001 From: justinmuller Date: Mon, 15 Jul 2013 21:17:55 -0600 Subject: [PATCH 0200/1055] Make field immutable. --- .../java/com/github/mobile/ui/issue/IssuesViewActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java index 91e16d570..c33b60c4c 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java @@ -166,7 +166,7 @@ public static Intent createIntent(Collection issues, @Inject private IssueStore store; - private AtomicReference user = new AtomicReference(); + private final AtomicReference user = new AtomicReference(); private IssuesPagerAdapter adapter; From 9b4b581d8a20673569c53fa29a07a05641b2d773 Mon Sep 17 00:00:00 2001 From: justinmuller Date: Mon, 15 Jul 2013 22:52:36 -0600 Subject: [PATCH 0201/1055] Convert private field to local variable. Closes #386 --- .../java/com/github/mobile/ui/issue/IssuesViewActivity.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java index c33b60c4c..ed12e9a30 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java @@ -158,8 +158,6 @@ public static Intent createIntent(Collection issues, private Repository repo; - private int initialPosition; - @Inject private AvatarLoader avatars; @@ -181,7 +179,7 @@ protected void onCreate(Bundle savedInstanceState) { pullRequests = getBooleanArrayExtra(EXTRA_PULL_REQUESTS); repoIds = getSerializableExtra(EXTRA_REPOSITORIES); repo = getSerializableExtra(EXTRA_REPOSITORY); - initialPosition = getIntExtra(EXTRA_POSITION); + int initialPosition = getIntExtra(EXTRA_POSITION); setContentView(layout.pager); From b2a8782ddae3ba748b03978aa9368213bae7ceeb Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Sat, 20 Jul 2013 21:16:15 +0300 Subject: [PATCH 0202/1055] no need for javadoc on private methods --- .../java/com/github/mobile/util/AvatarLoader.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/mobile/util/AvatarLoader.java index 618e1805c..b6f926c33 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/mobile/util/AvatarLoader.java @@ -121,12 +121,6 @@ public AvatarLoader(final Context context) { options.inPreferredConfig = ARGB_8888; } - /** - * Get image for user - * - * @param filename - * @return image - */ private BitmapDrawable getImageBy(String filename) { File avatarFile = new File(avatarDir, filename); @@ -142,12 +136,6 @@ private BitmapDrawable getImageBy(String filename) { } } - /** - * Decode file to bitmap - * - * @param file - * @return bitmap - */ private Bitmap decode(final File file) { return BitmapFactory.decodeFile(file.getAbsolutePath(), options); } From 47042f0f126439d40b309e1468cd98a15c933449 Mon Sep 17 00:00:00 2001 From: Mateusz Herych Date: Tue, 23 Apr 2013 11:58:54 +0200 Subject: [PATCH 0203/1055] caching avatars using urls, not userId Closes #349 --- .gitignore | 1 + .../com/github/mobile/util/AvatarLoader.java | 26 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 80c551df1..1848b97c7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ gen-external-apklibs *.iml .DS_Store *.swp +out diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/mobile/util/AvatarLoader.java index b6f926c33..b5b844ee5 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/mobile/util/AvatarLoader.java @@ -25,6 +25,7 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.text.TextUtils; +import android.util.Base64; import android.util.Log; import android.widget.ImageView; @@ -140,15 +141,19 @@ private Bitmap decode(final File file) { return BitmapFactory.decodeFile(file.getAbsolutePath(), options); } + private String getAvatarFilenameForUrl(String avatarUrl) { + return Base64.encodeToString(avatarUrl.getBytes(), Base64.DEFAULT); + } + /** * Fetch avatar from URL * * @param url - * @param userId + * @param cachedAvatarFilename * @return bitmap */ - protected BitmapDrawable fetchAvatar(final String url, final String userId) { - File rawAvatar = new File(avatarDir, userId + "-raw"); + protected BitmapDrawable fetchAvatar(final String url, final String cachedAvatarFilename) { + File rawAvatar = new File(avatarDir, cachedAvatarFilename + "-raw"); HttpRequest request = HttpRequest.get(url); if (request.ok()) request.receive(rawAvatar); @@ -168,7 +173,7 @@ protected BitmapDrawable fetchAvatar(final String url, final String userId) { return null; } - File roundedAvatar = new File(avatarDir, userId); + File roundedAvatar = new File(avatarDir, cachedAvatarFilename); FileOutputStream output = null; try { output = new FileOutputStream(roundedAvatar); @@ -232,11 +237,12 @@ public AvatarLoader bind(final ActionBar actionBar, @Override public BitmapDrawable call() throws Exception { - final BitmapDrawable image = getImageBy(userId); + final String avatarFilename = getAvatarFilenameForUrl(getAvatarUrl(user)); + final BitmapDrawable image = getImageBy(avatarFilename); if (image != null) return image; else - return fetchAvatar(avatarUrl, userId); + return fetchAvatar(avatarUrl, avatarFilename); } @Override @@ -361,16 +367,16 @@ public BitmapDrawable call() throws Exception { if (!userId.equals(view.getTag(id.iv_avatar))) return null; - final BitmapDrawable image = getImageBy(userId); + final String avatarFilename = getAvatarFilenameForUrl(avatarUrl); + final BitmapDrawable image = getImageBy(avatarFilename); if (image != null) return image; else - return fetchAvatar(avatarUrl, userId); + return fetchAvatar(avatarUrl, avatarFilename); } @Override - protected void onSuccess(final BitmapDrawable image) - throws Exception { + protected void onSuccess(final BitmapDrawable image) throws Exception { if (image == null) return; loaded.put(userId, image); From 014f68245e33935feec6cc6e498e9bac9a2c05eb Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Fri, 26 Jul 2013 00:07:34 +0300 Subject: [PATCH 0204/1055] storing avatars in a separate folder for user All avatars for a user are stored in a separate folder with the user id as the name. All files in that folder are deleted before writing a new one if the avatar doesn't already exist in that folder. This should solve the problem with the old avatars when avatar url is changed. --- .../com/github/mobile/util/AvatarLoader.java | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/mobile/util/AvatarLoader.java index b5b844ee5..b23b2eb95 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/mobile/util/AvatarLoader.java @@ -122,8 +122,8 @@ public AvatarLoader(final Context context) { options.inPreferredConfig = ARGB_8888; } - private BitmapDrawable getImageBy(String filename) { - File avatarFile = new File(avatarDir, filename); + private BitmapDrawable getImageBy(final String userId, final String filename) { + File avatarFile = new File(avatarDir + "/" + userId, filename); if (!avatarFile.exists() || avatarFile.length() == 0) return null; @@ -137,6 +137,15 @@ private BitmapDrawable getImageBy(String filename) { } } + private void deleteCachedUserAvatars(File userAvatarDir) { + if (!userAvatarDir.isDirectory()) + return; + + for (File userAvatar : userAvatarDir.listFiles()) { + userAvatar.delete(); + } + } + private Bitmap decode(final File file) { return BitmapFactory.decodeFile(file.getAbsolutePath(), options); } @@ -152,8 +161,15 @@ private String getAvatarFilenameForUrl(String avatarUrl) { * @param cachedAvatarFilename * @return bitmap */ - protected BitmapDrawable fetchAvatar(final String url, final String cachedAvatarFilename) { - File rawAvatar = new File(avatarDir, cachedAvatarFilename + "-raw"); + protected BitmapDrawable fetchAvatar(final String url, + final String userId, final String cachedAvatarFilename) { + File userAvatarDir = new File(avatarDir, userId); + if (!userAvatarDir.isDirectory()) + userAvatarDir.mkdirs(); + else + deleteCachedUserAvatars(userAvatarDir); + + File rawAvatar = new File(userAvatarDir, cachedAvatarFilename + "-raw"); HttpRequest request = HttpRequest.get(url); if (request.ok()) request.receive(rawAvatar); @@ -173,7 +189,7 @@ protected BitmapDrawable fetchAvatar(final String url, final String cachedAvatar return null; } - File roundedAvatar = new File(avatarDir, cachedAvatarFilename); + File roundedAvatar = new File(userAvatarDir, cachedAvatarFilename); FileOutputStream output = null; try { output = new FileOutputStream(roundedAvatar); @@ -238,11 +254,11 @@ public AvatarLoader bind(final ActionBar actionBar, @Override public BitmapDrawable call() throws Exception { final String avatarFilename = getAvatarFilenameForUrl(getAvatarUrl(user)); - final BitmapDrawable image = getImageBy(avatarFilename); + final BitmapDrawable image = getImageBy(userId, avatarFilename); if (image != null) return image; else - return fetchAvatar(avatarUrl, avatarFilename); + return fetchAvatar(avatarUrl, userId, avatarFilename); } @Override @@ -368,11 +384,11 @@ public BitmapDrawable call() throws Exception { return null; final String avatarFilename = getAvatarFilenameForUrl(avatarUrl); - final BitmapDrawable image = getImageBy(avatarFilename); + final BitmapDrawable image = getImageBy(userId, avatarFilename); if (image != null) return image; else - return fetchAvatar(avatarUrl, avatarFilename); + return fetchAvatar(avatarUrl, userId, avatarFilename); } @Override From 35a8899621821e818cf6eb8e755afc8b59fea4f7 Mon Sep 17 00:00:00 2001 From: justinmuller Date: Wed, 17 Jul 2013 18:42:54 -0600 Subject: [PATCH 0205/1055] Remove unused parameters in CommitDiffListFragment Remove unused parameter from private method, reduce scope of local variables. Closes #387 --- .../ui/commit/CommitDiffListFragment.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java index f87acf666..696a5fae5 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java @@ -261,41 +261,43 @@ protected void onException(Exception e) throws RuntimeException { } private boolean isDifferentCommitter(final String author, - final Date authorDate, final String committer, - final Date committerDate) { + final String committer) { return committer != null && !committer.equals(author); } private void addCommitDetails(RepositoryCommit commit) { adapter.addHeader(commitHeader); + commitMessage.setText(commit.getCommit().getMessage()); + String commitAuthor = CommitUtils.getAuthor(commit); - Date commitAuthorDate = CommitUtils.getAuthorDate(commit); String commitCommitter = CommitUtils.getCommitter(commit); - Date commitCommitterDate = CommitUtils.getCommiterDate(commit); - - commitMessage.setText(commit.getCommit().getMessage()); if (commitAuthor != null) { CommitUtils.bindAuthor(commit, avatars, authorAvatar); authorName.setText(commitAuthor); StyledText styledAuthor = new StyledText(); styledAuthor.append(getString(string.authored)); + + Date commitAuthorDate = CommitUtils.getAuthorDate(commit); if (commitAuthorDate != null) styledAuthor.append(' ').append(commitAuthorDate); + authorDate.setText(styledAuthor); ViewUtils.setGone(authorArea, false); } else ViewUtils.setGone(authorArea, true); - if (isDifferentCommitter(commitAuthor, commitAuthorDate, - commitCommitter, commitCommitterDate)) { + if (isDifferentCommitter(commitAuthor, commitCommitter)) { CommitUtils.bindCommitter(commit, avatars, committerAvatar); committerName.setText(commitCommitter); StyledText styledCommitter = new StyledText(); styledCommitter.append(getString(string.committed)); + + Date commitCommitterDate = CommitUtils.getCommiterDate(commit); if (commitCommitterDate != null) styledCommitter.append(' ').append(commitCommitterDate); + committerDate.setText(styledCommitter); ViewUtils.setGone(committerArea, false); } else From 0c25c3125d44830adb2808ea1930f9b513d75096 Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Wed, 10 Apr 2013 19:06:18 +0300 Subject: [PATCH 0206/1055] added a posibility to open commits compare screen for pull-requests. issues screen now has 'commits' button --- app/res/layout/issue_header.xml | 18 ++++++++++ app/res/values/strings.xml | 1 + .../github/mobile/core/issue/IssueStore.java | 3 ++ .../github/mobile/ui/issue/IssueFragment.java | 35 +++++++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/app/res/layout/issue_header.xml b/app/res/layout/issue_header.xml index c1f81dfc1..60e781419 100644 --- a/app/res/layout/issue_header.xml +++ b/app/res/layout/issue_header.xml @@ -64,6 +64,24 @@ + + + + + + updated\u0020 opened\u0020 Clear + Commits: %d Open Issues Closed Issues Remove Bookmark diff --git a/app/src/main/java/com/github/mobile/core/issue/IssueStore.java b/app/src/main/java/com/github/mobile/core/issue/IssueStore.java index c794b19ac..ca78edc88 100644 --- a/app/src/main/java/com/github/mobile/core/issue/IssueStore.java +++ b/app/src/main/java/com/github/mobile/core/issue/IssueStore.java @@ -159,6 +159,9 @@ public RepositoryIssue refreshIssue(IRepositoryIdProvider repository, Issue issue; try { issue = issueService.getIssue(repository, number); + if (IssueUtils.isPullRequest(issue)) + issue = IssueUtils.toIssue(pullService.getPullRequest( + repository, number)); } catch (IOException e) { if (e instanceof RequestException && 410 == ((RequestException) e).getStatus()) diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index 3b8e2e85c..310166151 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -65,6 +65,7 @@ import com.github.mobile.ui.HeaderFooterListAdapter; import com.github.mobile.ui.StyledText; import com.github.mobile.ui.comment.CommentListAdapter; +import com.github.mobile.ui.commit.CommitCompareViewActivity; import com.github.mobile.util.AvatarLoader; import com.github.mobile.util.HttpImageGetter; import com.github.mobile.util.ShareUtils; @@ -80,6 +81,8 @@ import org.eclipse.egit.github.core.Issue; import org.eclipse.egit.github.core.Label; import org.eclipse.egit.github.core.Milestone; +import org.eclipse.egit.github.core.PullRequest; +import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryId; import org.eclipse.egit.github.core.User; @@ -138,6 +141,8 @@ public class IssueFragment extends DialogFragment { private ImageView creatorAvatar; + private ViewGroup commitsView; + private TextView assigneeText; private ImageView assigneeAvatar; @@ -264,6 +269,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) { createdDateText = (TextView) headerView .findViewById(id.tv_issue_creation_date); creatorAvatar = (ImageView) headerView.findViewById(id.iv_avatar); + commitsView = (ViewGroup) headerView.findViewById(id.ll_issue_commits); assigneeText = (TextView) headerView.findViewById(id.tv_assignee_name); assigneeAvatar = (ImageView) headerView .findViewById(id.iv_assignee_avatar); @@ -278,6 +284,15 @@ public void onViewCreated(View view, Bundle savedInstanceState) { footerView = inflater.inflate(layout.footer_separator, null); + commitsView.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + if (IssueUtils.isPullRequest(issue)) + openPullRequestCommits(); + } + }); + stateText.setOnClickListener(new OnClickListener() { @Override @@ -336,6 +351,15 @@ private void updateHeader(final Issue issue) { getString(string.prefix_opened)).append(issue.getCreatedAt())); avatars.bind(creatorAvatar, issue.getUser()); + if (IssueUtils.isPullRequest(issue) && issue.getPullRequest().getCommits() > 0) { + ViewUtils.setGone(commitsView, false); + + String commits = getString(string.pull_request_commits, + issue.getPullRequest().getCommits()); + ((TextView) commitsView.findViewById(id.tv_pull_request_commits)).setText(commits); + } else + ViewUtils.setGone(commitsView, true); + boolean open = STATE_OPEN.equals(issue.getState()); if (!open) { StyledText text = new StyledText(); @@ -530,6 +554,17 @@ private void shareIssue() { + issueNumber)); } + private void openPullRequestCommits() { + if (IssueUtils.isPullRequest(issue)) { + PullRequest pullRequest = issue.getPullRequest(); + + String base = pullRequest.getBase().getSha(); + String head = pullRequest.getHead().getSha(); + Repository repo = pullRequest.getBase().getRepo(); + startActivity(CommitCompareViewActivity.createIntent(repo, base, head)); + } + } + @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { From 77c385171bd04a04ae75fe9d35e0dd17a743e411 Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Wed, 10 Apr 2013 19:40:12 +0300 Subject: [PATCH 0207/1055] commit icon near to 'commits' field --- app/res/layout/issue_header.xml | 8 +++++++- .../java/com/github/mobile/ui/issue/IssueFragment.java | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/res/layout/issue_header.xml b/app/res/layout/issue_header.xml index 60e781419..3f22ba1d4 100644 --- a/app/res/layout/issue_header.xml +++ b/app/res/layout/issue_header.xml @@ -71,13 +71,19 @@ android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:background="@drawable/inset_background" - android:orientation="vertical" + android:orientation="horizontal" android:visibility="gone" > + + diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index 310166151..a8cf8cd0b 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -32,6 +32,7 @@ import static com.github.mobile.RequestCodes.ISSUE_MILESTONE_UPDATE; import static com.github.mobile.RequestCodes.ISSUE_REOPEN; import static org.eclipse.egit.github.core.service.IssueService.STATE_OPEN; +import static com.github.mobile.util.TypefaceUtils.ICON_COMMIT; import android.app.Activity; import android.content.Intent; import android.os.Bundle; @@ -70,6 +71,7 @@ import com.github.mobile.util.HttpImageGetter; import com.github.mobile.util.ShareUtils; import com.github.mobile.util.ToastUtils; +import com.github.mobile.util.TypefaceUtils; import com.google.inject.Inject; import java.util.ArrayList; @@ -354,6 +356,10 @@ private void updateHeader(final Issue issue) { if (IssueUtils.isPullRequest(issue) && issue.getPullRequest().getCommits() > 0) { ViewUtils.setGone(commitsView, false); + TextView icon = (TextView) commitsView.findViewById(id.tv_commit_icon); + TypefaceUtils.setOcticons(icon); + icon.setText(ICON_COMMIT); + String commits = getString(string.pull_request_commits, issue.getPullRequest().getCommits()); ((TextView) commitsView.findViewById(id.tv_pull_request_commits)).setText(commits); From 26e7fc34b32dca448691eda7f019538310f6818c Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Wed, 10 Apr 2013 20:09:05 +0300 Subject: [PATCH 0208/1055] moved 'commits' label below the description --- app/res/layout/issue_header.xml | 48 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/app/res/layout/issue_header.xml b/app/res/layout/issue_header.xml index 3f22ba1d4..8b1a894a3 100644 --- a/app/res/layout/issue_header.xml +++ b/app/res/layout/issue_header.xml @@ -64,30 +64,6 @@ - - - - - - - - + + + + + + + + \ No newline at end of file From ce8c70989794647c5d74f3a6ac65a38d0db22988 Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Fri, 26 Jul 2013 01:13:16 +0300 Subject: [PATCH 0209/1055] Use ViewFinder to set text on TextViews --- .../main/java/com/github/mobile/ui/issue/IssueFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java index a8cf8cd0b..c880ecddf 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java @@ -356,13 +356,13 @@ private void updateHeader(final Issue issue) { if (IssueUtils.isPullRequest(issue) && issue.getPullRequest().getCommits() > 0) { ViewUtils.setGone(commitsView, false); - TextView icon = (TextView) commitsView.findViewById(id.tv_commit_icon); + TextView icon = finder.textView(id.tv_commit_icon); TypefaceUtils.setOcticons(icon); icon.setText(ICON_COMMIT); String commits = getString(string.pull_request_commits, issue.getPullRequest().getCommits()); - ((TextView) commitsView.findViewById(id.tv_pull_request_commits)).setText(commits); + finder.setText(id.tv_pull_request_commits, commits); } else ViewUtils.setGone(commitsView, true); From bd4742582fcec091301f9310b321d667b707e9de Mon Sep 17 00:00:00 2001 From: justinmuller Date: Fri, 26 Jul 2013 01:28:46 -0600 Subject: [PATCH 0210/1055] Fix typo in method name. Closes #391 --- .../java/com/github/mobile/core/commit/CommitUtils.java | 6 +++--- .../github/mobile/ui/commit/CommitDiffListFragment.java | 2 +- .../com/github/mobile/tests/commit/CommitUtilsTest.java | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/github/mobile/core/commit/CommitUtils.java b/app/src/main/java/com/github/mobile/core/commit/CommitUtils.java index bbcb1f06a..1afba8cf4 100644 --- a/app/src/main/java/com/github/mobile/core/commit/CommitUtils.java +++ b/app/src/main/java/com/github/mobile/core/commit/CommitUtils.java @@ -152,13 +152,13 @@ public static Date getAuthorDate(final RepositoryCommit commit) { * @param commit * @return author name or null if missing */ - public static Date getCommiterDate(final RepositoryCommit commit) { + public static Date getCommitterDate(final RepositoryCommit commit) { Commit rawCommit = commit.getCommit(); if (rawCommit == null) return null; - CommitUser commitCommiter = rawCommit.getCommitter(); - return commitCommiter != null ? commitCommiter.getDate() : null; + CommitUser commitCommitter = rawCommit.getCommitter(); + return commitCommitter != null ? commitCommitter.getDate() : null; } /** diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java index 696a5fae5..b3b03e9e3 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java @@ -294,7 +294,7 @@ private void addCommitDetails(RepositoryCommit commit) { StyledText styledCommitter = new StyledText(); styledCommitter.append(getString(string.committed)); - Date commitCommitterDate = CommitUtils.getCommiterDate(commit); + Date commitCommitterDate = CommitUtils.getCommitterDate(commit); if (commitCommitterDate != null) styledCommitter.append(' ').append(commitCommitterDate); diff --git a/integration-tests/src/main/java/com/github/mobile/tests/commit/CommitUtilsTest.java b/integration-tests/src/main/java/com/github/mobile/tests/commit/CommitUtilsTest.java index ec001a8dc..6735984e3 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/commit/CommitUtilsTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/commit/CommitUtilsTest.java @@ -129,14 +129,14 @@ public void testGetAuthorDate() { */ public void testGetCommitterDate() { RepositoryCommit commit = new RepositoryCommit(); - assertNull(CommitUtils.getCommiterDate(commit)); + assertNull(CommitUtils.getCommitterDate(commit)); Commit rawCommit = new Commit(); commit.setCommit(rawCommit); - assertNull(CommitUtils.getCommiterDate(commit)); + assertNull(CommitUtils.getCommitterDate(commit)); CommitUser user = new CommitUser(); rawCommit.setCommitter(user); - assertNull(CommitUtils.getCommiterDate(commit)); + assertNull(CommitUtils.getCommitterDate(commit)); user.setDate(new Date(12345)); - assertEquals(new Date(12345), CommitUtils.getCommiterDate(commit)); + assertEquals(new Date(12345), CommitUtils.getCommitterDate(commit)); } } From 719ebed483fff3ee0edb0ca64e7b8231dc02f582 Mon Sep 17 00:00:00 2001 From: Artur Termenji Date: Sun, 31 Mar 2013 23:31:27 +0300 Subject: [PATCH 0211/1055] Add contributors screen --- app/AndroidManifest.xml | 10 +++ app/res/layout/contributor_item.xml | 49 ++++++++++ app/res/layout/repo_contributors.xml | 35 ++++++++ app/res/menu/repository.xml | 4 + app/res/values/strings.xml | 4 + app/res/values/styles.xml | 10 +++ .../ui/repo/ContributorListAdapter.java | 70 +++++++++++++++ .../repo/RepositoryContributorsActivity.java | 85 ++++++++++++++++++ .../repo/RepositoryContributorsFragment.java | 90 +++++++++++++++++++ .../ui/repo/RepositoryViewActivity.java | 3 + .../com/github/mobile/util/AvatarLoader.java | 29 ++++++ 11 files changed, 389 insertions(+) create mode 100644 app/res/layout/contributor_item.xml create mode 100644 app/res/layout/repo_contributors.xml create mode 100644 app/src/main/java/com/github/mobile/ui/repo/ContributorListAdapter.java create mode 100644 app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsActivity.java create mode 100644 app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsFragment.java diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index f7b5f7a37..8c6ac1de3 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -185,6 +185,16 @@ android:name="android.app.default_searchable" android:value=".ui.issue.IssueSearchActivity" /> + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/res/layout/repo_contributors.xml b/app/res/layout/repo_contributors.xml new file mode 100644 index 000000000..6bf48ef59 --- /dev/null +++ b/app/res/layout/repo_contributors.xml @@ -0,0 +1,35 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/res/menu/repository.xml b/app/res/menu/repository.xml index fd94ce036..7d89e4761 100644 --- a/app/res/menu/repository.xml +++ b/app/res/menu/repository.xml @@ -20,6 +20,10 @@ android:id="@+id/m_star" android:showAsAction="never" android:title="@string/star"/> + Loading issues failed Loading repositories failed Loading repository failed + Loading contributors failed Loading Gist failed Loading news failed Loading followers failed @@ -73,6 +74,7 @@ No Bookmarks No Repositories + No contributors No Issues No Gists No People @@ -131,6 +133,7 @@ Enter a comment Show More… Repositories + Contributors Issues Edit Labels Milestone: @@ -238,6 +241,7 @@ Unstarring… Navigate to… Navigate to %s + %d commits repositories diff --git a/app/res/values/styles.xml b/app/res/values/styles.xml index 983e54b74..2a0a1b087 100644 --- a/app/res/values/styles.xml +++ b/app/res/values/styles.xml @@ -26,6 +26,11 @@ 28dp + + + + + + + - + + - - \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/ui/SlidingTabLayout.java b/app/src/main/java/com/github/mobile/ui/SlidingTabLayout.java index 964292e85..59ec6fa6c 100644 --- a/app/src/main/java/com/github/mobile/ui/SlidingTabLayout.java +++ b/app/src/main/java/com/github/mobile/ui/SlidingTabLayout.java @@ -221,7 +221,12 @@ private void populateTabStrip() { tabView.setOnClickListener(tabClickListener); mTabStrip.addView(tabView); + + if (i == mViewPager.getCurrentItem()) { + tabView.setSelected(true); + } } + } @Override @@ -291,7 +296,9 @@ public void onPageSelected(int position) { mTabStrip.onViewPagerPageChanged(position, 0f); scrollToTab(position, 0); } - + for (int i = 0; i < mTabStrip.getChildCount(); i++) { + mTabStrip.getChildAt(i).setSelected(position == i); + } if (mViewPagerPageChangeListener != null) { mViewPagerPageChangeListener.onPageSelected(position); } diff --git a/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java b/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java index 29ffb847f..6bae00f4d 100644 --- a/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java +++ b/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java @@ -28,9 +28,9 @@ class SlidingTabStrip extends LinearLayout { - private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 2; + private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 0; private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26; - private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 8; + private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 6; private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5; private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1; diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index f81ddfe92..f93db1410 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -158,6 +158,7 @@ protected void onCreate(Bundle savedInstanceState) { pager = (ViewPager) findViewById(R.id.vp_pages); pager.setOnPageChangeListener(this); slidingTabsLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs_layout); + slidingTabsLayout.setCustomTabView(R.layout.tab, R.id.tv_tab); slidingTabsLayout.setSelectedIndicatorColors(getResources().getColor(android.R.color.white)); slidingTabsLayout.setDividerColors(0); } From 6fb6bcd9fa3fd5426a6787b3907be31be156b2b7 Mon Sep 17 00:00:00 2001 From: Mustafa Ali Date: Wed, 7 Jan 2015 23:10:54 -0600 Subject: [PATCH 0399/1055] Removed blue header since it doesn't goes along with Material design --- app/res/layout/commit_diff_list.xml | 8 +------- app/res/layout/commit_file_view.xml | 8 +------- app/res/layout/gist_create.xml | 8 +------- app/res/layout/issue_edit.xml | 8 +------- app/res/layout/issue_search.xml | 8 +------- app/res/layout/issues_filter_edit.xml | 8 +------- app/res/layout/issues_filter_list.xml | 8 +------- app/res/layout/repo_contributors.xml | 8 +------- app/res/layout/repo_issue_list.xml | 8 +------- app/res/values/styles.xml | 6 ------ .../java/com/github/mobile/ui/issue/IssueFragment.java | 4 ---- 11 files changed, 9 insertions(+), 73 deletions(-) diff --git a/app/res/layout/commit_diff_list.xml b/app/res/layout/commit_diff_list.xml index 744bf3c26..7ca96a8d9 100644 --- a/app/res/layout/commit_diff_list.xml +++ b/app/res/layout/commit_diff_list.xml @@ -18,19 +18,13 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - - diff --git a/app/res/layout/commit_file_view.xml b/app/res/layout/commit_file_view.xml index 35d5f8c18..635fb6eee 100644 --- a/app/res/layout/commit_file_view.xml +++ b/app/res/layout/commit_file_view.xml @@ -19,17 +19,11 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - - - - + android:layout_alignParentTop="true" > - - - - \ No newline at end of file diff --git a/app/res/layout/issues_filter_edit.xml b/app/res/layout/issues_filter_edit.xml index 43bcf89b8..c3f9da793 100644 --- a/app/res/layout/issues_filter_edit.xml +++ b/app/res/layout/issues_filter_edit.xml @@ -18,16 +18,10 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - - + android:layout_alignParentTop="true" > - - \ No newline at end of file diff --git a/app/res/layout/repo_contributors.xml b/app/res/layout/repo_contributors.xml index 6bf48ef59..a18cd9243 100644 --- a/app/res/layout/repo_contributors.xml +++ b/app/res/layout/repo_contributors.xml @@ -18,18 +18,12 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - \ No newline at end of file diff --git a/app/res/layout/repo_issue_list.xml b/app/res/layout/repo_issue_list.xml index 65169d924..44c7be9fb 100644 --- a/app/res/layout/repo_issue_list.xml +++ b/app/res/layout/repo_issue_list.xml @@ -18,18 +18,12 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - - \ No newline at end of file diff --git a/app/res/values/styles.xml b/app/res/values/styles.xml index 71b459e38..79880842f 100644 --- a/app/res/values/styles.xml +++ b/app/res/values/styles.xml @@ -219,12 +219,6 @@ 64dp - - diff --git a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java index 2c4ed7868..cff4b0bcb 100644 --- a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java +++ b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java @@ -111,11 +111,11 @@ public static void configureSyncFor(Account account) { ContentResolver.setIsSyncable(account, PROVIDER_AUTHORITY, 1); ContentResolver.setSyncAutomatically(account, PROVIDER_AUTHORITY, true); ContentResolver.addPeriodicSync(account, PROVIDER_AUTHORITY, - new Bundle(), SYNC_PERIOD); + new Bundle(), SYNC_PERIOD); } public static class AccountLoader extends - AuthenticatedUserTask> { + AuthenticatedUserTask> { @Inject private AccountDataManager cache; @@ -163,6 +163,8 @@ public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.login); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + accountManager = AccountManager.get(this); ViewFinder finder = new ViewFinder(this); @@ -174,7 +176,7 @@ public void onCreate(Bundle savedInstanceState) { authTokenType = intent.getStringExtra(PARAM_AUTHTOKEN_TYPE); requestNewAccount = username == null; confirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, - false); + false); TextView signupText = finder.find(R.id.tv_signup); signupText.setMovementMethod(LinkMovementMethod.getInstance()); @@ -201,7 +203,7 @@ public void afterTextChanged(Editable gitDirEditText) { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event != null && ACTION_DOWN == event.getAction() - && keyCode == KEYCODE_ENTER && loginEnabled()) { + && keyCode == KEYCODE_ENTER && loginEnabled()) { handleLogin(); return true; } else @@ -213,7 +215,7 @@ public boolean onKey(View v, int keyCode, KeyEvent event) { @Override public boolean onEditorAction(TextView v, int actionId, - KeyEvent event) { + KeyEvent event) { if (actionId == IME_ACTION_DONE && loginEnabled()) { handleLogin(); return true; @@ -227,7 +229,7 @@ public boolean onEditorAction(TextView v, int actionId, @Override public void onCheckedChanged(CompoundButton buttonView, - boolean isChecked) { + boolean isChecked) { int type = TYPE_CLASS_TEXT; if (isChecked) type |= TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; @@ -240,9 +242,9 @@ public void onCheckedChanged(CompoundButton buttonView, } }); - loginText.setAdapter(new ArrayAdapter(this, - android.R.layout.simple_dropdown_item_1line, - getEmailAddresses())); + loginText.setAdapter(new ArrayAdapter<>(this, + android.R.layout.simple_dropdown_item_1line, + getEmailAddresses())); } @Override @@ -254,7 +256,7 @@ protected void onResume() { Account existing = AccountUtils.getPasswordAccessibleAccount(this); if (existing != null && !TextUtils.isEmpty(existing.name)) { String password = AccountManager.get(this) - .getPassword(existing); + .getPassword(existing); if (!TextUtils.isEmpty(password)) finishLogin(existing.name, password); } @@ -266,7 +268,7 @@ protected void onResume() { private boolean loginEnabled() { return !TextUtils.isEmpty(loginText.getText()) - && !TextUtils.isEmpty(passwordText.getText()); + && !TextUtils.isEmpty(passwordText.getText()); } private void updateEnablement() { @@ -291,7 +293,7 @@ public void handleLogin() { password = passwordText.getText().toString(); final AlertDialog dialog = LightProgressDialog.create(this, - R.string.login_activity_authenticating); + R.string.login_activity_authenticating); dialog.setCancelable(true); dialog.setOnCancelListener(new OnCancelListener() { @@ -324,7 +326,7 @@ public User call() throws Exception { Account account = new Account(user.getLogin(), ACCOUNT_TYPE); if (requestNewAccount) { accountManager - .addAccountExplicitly(account, password, null); + .addAccountExplicitly(account, password, null); configureSyncFor(account); try { new AccountLoader(LoginActivity.this).call(); @@ -362,13 +364,13 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == OTP_CODE_ENTER) { switch (resultCode) { - case RESULT_OK: - onAuthenticationResult(true); - break; - case RESULT_CANCELED: - Exception e = (Exception) data.getExtras().getSerializable(PARAM_EXCEPTION); - handleLoginException(e); - break; + case RESULT_OK: + onAuthenticationResult(true); + break; + case RESULT_CANCELED: + Exception e = (Exception) data.getExtras().getSerializable(PARAM_EXCEPTION); + handleLoginException(e); + break; } } } @@ -434,11 +436,11 @@ public void onAuthenticationResult(boolean result) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.m_login: - handleLogin(); - return true; - default: - return super.onOptionsItemSelected(item); + case R.id.m_login: + handleLogin(); + return true; + default: + return super.onOptionsItemSelected(item); } } @@ -452,8 +454,8 @@ public boolean onCreateOptionsMenu(Menu optionMenu) { private List getEmailAddresses() { final Account[] accounts = accountManager - .getAccountsByType("com.google"); - final List addresses = new ArrayList(accounts.length); + .getAccountsByType("com.google"); + final List addresses = new ArrayList<>(accounts.length); for (Account account : accounts) addresses.add(account.name); return addresses; diff --git a/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthActivity.java b/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthActivity.java index f88f9398c..2c3e4623d 100644 --- a/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthActivity.java +++ b/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthActivity.java @@ -44,8 +44,8 @@ import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.mobile.R; import com.github.mobile.ui.LightProgressDialog; -import com.github.mobile.ui.roboactivities.RoboActionBarActivity; import com.github.mobile.ui.TextWatcherAdapter; +import com.github.mobile.ui.roboactivities.RoboActionBarActivity; import java.io.IOException; @@ -109,6 +109,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.login_two_factor_auth); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + accountManager = AccountManager.get(this); ViewFinder finder = new ViewFinder(this); @@ -136,7 +138,7 @@ public void afterTextChanged(Editable gitDirEditText) { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event != null && ACTION_DOWN == event.getAction() - && keyCode == KEYCODE_ENTER && loginEnabled()) { + && keyCode == KEYCODE_ENTER && loginEnabled()) { handleLogin(); return true; } else @@ -148,7 +150,7 @@ public boolean onKey(View v, int keyCode, KeyEvent event) { @Override public boolean onEditorAction(TextView v, int actionId, - KeyEvent event) { + KeyEvent event) { if (actionId == IME_ACTION_DONE && loginEnabled()) { handleLogin(); return true; @@ -177,11 +179,11 @@ private void updateEnablement() { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.m_login: - handleLogin(); - return true; - default: - return super.onOptionsItemSelected(item); + case R.id.m_login: + handleLogin(); + return true; + default: + return super.onOptionsItemSelected(item); } } @@ -196,7 +198,7 @@ private void handleLogin() { final String otpCode = otpCodeText.getText().toString(); final AlertDialog dialog = LightProgressDialog.create(this, - R.string.login_activity_authenticating); + R.string.login_activity_authenticating); dialog.setCancelable(true); dialog.setOnCancelListener(new OnCancelListener() { diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java b/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java index deed6c680..214a2af62 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java +++ b/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java @@ -24,13 +24,14 @@ import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; + import roboguice.fragment.RoboDialogFragment; /** * Base dialog fragment helper */ public abstract class DialogFragmentHelper extends RoboDialogFragment implements - OnClickListener { + OnClickListener { /** * Dialog message @@ -56,7 +57,7 @@ public abstract class DialogFragmentHelper extends RoboDialogFragment implements * @param tag */ protected static void show(FragmentActivity activity, - DialogFragmentHelper fragment, Bundle arguments, String tag) { + DialogFragmentHelper fragment, Bundle arguments, String tag) { FragmentManager manager = activity.getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); Fragment current = manager.findFragmentByTag(tag); @@ -77,7 +78,7 @@ protected static void show(FragmentActivity activity, * @return bundle */ protected static Bundle createArguments(final String title, - final String message, final int requestCode) { + final String message, final int requestCode) { Bundle arguments = new Bundle(); arguments.putInt(ARG_REQUEST_CODE, requestCode); arguments.putString(ARG_TITLE, title); @@ -96,7 +97,7 @@ protected void onResult(final int resultCode) { final Bundle arguments = getArguments(); if (arguments != null) activity.onDialogResult(arguments.getInt(ARG_REQUEST_CODE), - resultCode, arguments); + resultCode, arguments); } } diff --git a/app/src/main/java/com/github/mobile/ui/MainActivity.java b/app/src/main/java/com/github/mobile/ui/MainActivity.java index 326836c70..ea5761c2a 100644 --- a/app/src/main/java/com/github/mobile/ui/MainActivity.java +++ b/app/src/main/java/com/github/mobile/ui/MainActivity.java @@ -21,7 +21,7 @@ import com.github.mobile.core.user.UserComparator; import com.github.mobile.persistence.AccountDataManager; import com.github.mobile.ui.gist.GistsPagerFragment; -import com.github.mobile.ui.issue.FiltersViewFragment; +import com.github.mobile.ui.issue.FilterListFragment; import com.github.mobile.ui.issue.IssueDashboardPagerFragment; import com.github.mobile.ui.repo.OrganizationLoader; import com.github.mobile.ui.user.HomePagerFragment; @@ -60,6 +60,7 @@ public class MainActivity extends BaseActivity implements NavigationDrawerFragme protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); getSupportLoaderManager().initLoader(0, null, this); @@ -155,16 +156,16 @@ public void onNavigationDrawerItemSelected(int position) { fragmet = new IssueDashboardPagerFragment(); break; case 3: - fragmet = new FiltersViewFragment(); + fragmet = new FilterListFragment(); break; default: fragmet = new HomePagerFragment(); - args.putSerializable("org", orgs.get(position-5)); + args.putSerializable("org", orgs.get(position - 5)); break; } fragmet.setArguments(args); FragmentManager manager = getSupportFragmentManager(); - manager.beginTransaction().replace(R.id.container,fragmet).commit(); + manager.beginTransaction().replace(R.id.container, fragmet).commit(); } } diff --git a/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java b/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java index 3c47ba311..d344fe187 100644 --- a/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java +++ b/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java @@ -162,11 +162,11 @@ public void run() { } private void selectItem(int position) { - mCurrentSelectedPosition = position; - if (mCallbacks != null && mDrawerListView != null) + if (mCallbacks != null && mDrawerListView != null && position != mCurrentSelectedPosition) mCallbacks.onNavigationDrawerItemSelected(position); if (mDrawerListView != null) mDrawerListView.setItemChecked(position, true); if (mDrawerLayout != null) mDrawerLayout.closeDrawer(mFragmentContainerView); + mCurrentSelectedPosition = position; } @Override diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index f93db1410..afc31366e 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -152,6 +152,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(getContentView()); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + // On Lollipop, the action bar shadow is provided by default, so have to remove it explicitly getSupportActionBar().setElevation(0); diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerFragment.java b/app/src/main/java/com/github/mobile/ui/TabPagerFragment.java index cafbe9ee7..93105f58f 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerFragment.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerFragment.java @@ -94,10 +94,10 @@ public void onDestroy() { /** * Set current item to new position - *

+ *

* This is guaranteed to only be called when a position changes and the * current item of the pager has already been updated to the given position - *

+ *

* Sub-classes may override this method * * @param position @@ -132,13 +132,14 @@ protected void configureTabPager() { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - return inflater.inflate(getContentView(),null); + return inflater.inflate(getContentView(), null); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setHasOptionsMenu(true); + view.findViewById(R.id.toolbar).setVisibility(View.GONE); // On Lollipop, the action bar shadow is provided by default, so have to remove it explicitly ((ActionBarActivity) getActivity()).getSupportActionBar().setElevation(0); diff --git a/app/src/main/java/com/github/mobile/ui/TestFragment.java b/app/src/main/java/com/github/mobile/ui/TestFragment.java deleted file mode 100644 index 5d90a35dd..000000000 --- a/app/src/main/java/com/github/mobile/ui/TestFragment.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.github.mobile.ui; - -import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.ActionBarActivity; - -import com.github.mobile.R; -import com.github.mobile.ui.gist.GistsPagerFragment; -import com.github.mobile.ui.issue.FiltersViewFragment; -import com.github.mobile.ui.issue.IssueDashboardPagerFragment; - -/** - * Created by Henrik on 2015-01-07. - */ -public class TestFragment extends com.github.mobile.ui.roboactivities.RoboActionBarActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.frament_test); - FragmentManager manager = getSupportFragmentManager(); - manager.beginTransaction().replace(R.id.container, new FiltersViewFragment()).commit(); - } -} diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java index 725c206c6..a9904143d 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java @@ -50,7 +50,7 @@ public class CommitCompareViewActivity extends DialogFragmentActivity { * @return intent */ public static Intent createIntent(final Repository repository, - final String base, final String head) { + final String base, final String head) { Builder builder = new Builder("commits.compare.VIEW"); builder.add(EXTRA_BASE, base); builder.add(EXTRA_HEAD, head); @@ -73,13 +73,15 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.commit_compare); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setSubtitle(repository.generateId()); avatars.bind(actionBar, repository.getOwner()); fragment = getSupportFragmentManager() - .findFragmentById(android.R.id.list); + .findFragmentById(android.R.id.list); } @Override @@ -93,16 +95,16 @@ public boolean onCreateOptionsMenu(Menu optionsMenu) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - Intent intent = RepositoryViewActivity.createIntent(repository); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - return true; - default: - if (fragment != null) - return fragment.onOptionsItemSelected(item); - else - return super.onOptionsItemSelected(item); + case android.R.id.home: + Intent intent = RepositoryViewActivity.createIntent(repository); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + return true; + default: + if (fragment != null) + return fragment.onOptionsItemSelected(item); + else + return super.onOptionsItemSelected(item); } } } diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java index 899ac0b7c..85a2fff6c 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java @@ -59,7 +59,7 @@ * Activity to display the contents of a file in a commit */ public class CommitFileViewActivity extends BaseActivity implements - LoaderCallbacks { + LoaderCallbacks { private static final String TAG = "CommitFileViewActivity"; @@ -76,7 +76,7 @@ public class CommitFileViewActivity extends BaseActivity implements * @return intent */ public static Intent createIntent(Repository repository, String commit, - CommitFile file) { + CommitFile file) { Builder builder = new Builder("commit.file.VIEW"); builder.repo(repository); builder.add(EXTRA_HEAD, commit); @@ -121,6 +121,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.commit_file_view); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + repo = getSerializableExtra(EXTRA_REPOSITORY); commit = getStringExtra(EXTRA_HEAD); sha = getStringExtra(EXTRA_BASE); @@ -134,7 +136,7 @@ protected void onCreate(Bundle savedInstanceState) { editor = new SourceEditor(codeView); editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean( - WRAP, false)); + WRAP, false)); ActionBar actionBar = getSupportActionBar(); int lastSlash = path.lastIndexOf('/'); @@ -143,7 +145,7 @@ protected void onCreate(Bundle savedInstanceState) { else actionBar.setTitle(path); actionBar.setSubtitle(getString(R.string.commit_prefix) - + CommitUtils.abbreviate(commit)); + + CommitUtils.abbreviate(commit)); avatars.bind(actionBar, repo.getOwner()); loadContent(); @@ -164,7 +166,7 @@ public boolean onCreateOptionsMenu(final Menu optionsMenu) { markdownItem.setEnabled(blob != null); markdownItem.setVisible(true); if (PreferenceUtils.getCodePreferences(this).getBoolean( - RENDER_MARKDOWN, true)) + RENDER_MARKDOWN, true)) markdownItem.setTitle(R.string.show_raw_markdown); else markdownItem.setTitle(R.string.render_markdown); @@ -176,39 +178,39 @@ public boolean onCreateOptionsMenu(final Menu optionsMenu) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.m_wrap: - if (editor.getWrap()) - item.setTitle(R.string.enable_wrapping); - else - item.setTitle(R.string.disable_wrapping); - editor.toggleWrap(); - PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) - .edit().putBoolean(WRAP, editor.getWrap())); - return true; - - case R.id.m_share: - shareFile(); - return true; - - case R.id.m_render_markdown: - if (editor.isMarkdown()) { - item.setTitle(R.string.render_markdown); - editor.toggleMarkdown(); - editor.setSource(file, blob); - } else { - item.setTitle(R.string.show_raw_markdown); - editor.toggleMarkdown(); - if (renderedMarkdown != null) - editor.setSource(file, renderedMarkdown, false); + case R.id.m_wrap: + if (editor.getWrap()) + item.setTitle(R.string.enable_wrapping); else - loadMarkdown(); - } - PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) + item.setTitle(R.string.disable_wrapping); + editor.toggleWrap(); + PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) + .edit().putBoolean(WRAP, editor.getWrap())); + return true; + + case R.id.m_share: + shareFile(); + return true; + + case R.id.m_render_markdown: + if (editor.isMarkdown()) { + item.setTitle(R.string.render_markdown); + editor.toggleMarkdown(); + editor.setSource(file, blob); + } else { + item.setTitle(R.string.show_raw_markdown); + editor.toggleMarkdown(); + if (renderedMarkdown != null) + editor.setSource(file, renderedMarkdown, false); + else + loadMarkdown(); + } + PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) .edit().putBoolean(RENDER_MARKDOWN, editor.isMarkdown())); - return true; + return true; - default: - return super.onOptionsItemSelected(item); + default: + return super.onOptionsItemSelected(item); } } @@ -216,13 +218,13 @@ public boolean onOptionsItemSelected(MenuItem item) { public Loader onCreateLoader(int loader, Bundle args) { final String raw = args.getString(ARG_TEXT); final IRepositoryIdProvider repo = (IRepositoryIdProvider) args - .getSerializable(ARG_REPO); + .getSerializable(ARG_REPO); return new MarkdownLoader(this, repo, raw, imageGetter, false); } @Override public void onLoadFinished(Loader loader, - CharSequence rendered) { + CharSequence rendered) { if (rendered == null) ToastUtils.show(this, R.string.error_rendering_markdown); @@ -244,8 +246,8 @@ public void onLoaderReset(Loader loader) { private void shareFile() { String id = repo.generateId(); startActivity(ShareUtils.create( - path + " at " + CommitUtils.abbreviate(commit) + " on " + id, - "https://github.com/" + id + "/blob/" + commit + '/' + path)); + path + " at " + CommitUtils.abbreviate(commit) + " on " + id, + "https://github.com/" + id + "/blob/" + commit + '/' + path)); } private void loadMarkdown() { @@ -253,7 +255,7 @@ private void loadMarkdown() { ViewUtils.setGone(codeView, true); String markdown = new String( - EncodingUtils.fromBase64(blob.getContent())); + EncodingUtils.fromBase64(blob.getContent())); Bundle args = new Bundle(); args.putCharSequence(ARG_TEXT, markdown); args.putSerializable(ARG_REPO, repo); @@ -277,9 +279,9 @@ protected void onSuccess(Blob blob) throws Exception { markdownItem.setEnabled(true); if (isMarkdownFile - && PreferenceUtils.getCodePreferences( - CommitFileViewActivity.this).getBoolean( - RENDER_MARKDOWN, true)) + && PreferenceUtils.getCodePreferences( + CommitFileViewActivity.this).getBoolean( + RENDER_MARKDOWN, true)) loadMarkdown(); else { ViewUtils.setGone(loadingBar, true); @@ -297,7 +299,7 @@ protected void onException(Exception e) throws RuntimeException { ViewUtils.setGone(loadingBar, true); ViewUtils.setGone(codeView, false); ToastUtils.show(CommitFileViewActivity.this, e, - R.string.error_file_load); + R.string.error_file_load); } }.execute(); } diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java b/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java index 085d0a2c3..0f0fbb9c6 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java @@ -53,7 +53,7 @@ public class CommitViewActivity extends PagerActivity { * @return intent */ public static Intent createIntent(final Repository repository, - final String id) { + final String id) { return createIntent(repository, 0, id); } @@ -66,7 +66,7 @@ public static Intent createIntent(final Repository repository, * @return intent */ public static Intent createIntent(final Repository repository, - final int position, final Collection commits) { + final int position, final Collection commits) { String[] ids = new String[commits.size()]; int index = 0; for (RepositoryCommit commit : commits) @@ -83,7 +83,7 @@ public static Intent createIntent(final Repository repository, * @return intent */ public static Intent createIntent(final Repository repository, - final int position, final String... ids) { + final int position, final String... ids) { Builder builder = new Builder("commits.VIEW"); builder.add(EXTRA_POSITION, position); builder.add(EXTRA_BASES, ids); @@ -110,6 +110,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.pager); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + pager = finder.find(R.id.vp_pages); repository = getSerializableExtra(EXTRA_REPOSITORY); @@ -131,13 +133,13 @@ protected void onCreate(Bundle savedInstanceState) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - Intent intent = RepositoryViewActivity.createIntent(repository); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - return true; - default: - return super.onOptionsItemSelected(item); + case android.R.id.home: + Intent intent = RepositoryViewActivity.createIntent(repository); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + return true; + default: + return super.onOptionsItemSelected(item); } } diff --git a/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java b/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java index ca5ed0c43..1810547f2 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java @@ -56,6 +56,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.gist_create); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + descriptionText = finder.find(R.id.et_gist_description); nameText = finder.find(R.id.et_gist_name); contentText = finder.find(R.id.et_gist_content); @@ -105,17 +107,17 @@ public boolean onCreateOptionsMenu(Menu options) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.m_apply: - createGist(); - return true; - case android.R.id.home: - finish(); - Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - return true; - default: - return super.onOptionsItemSelected(item); + case R.id.m_apply: + createGist(); + return true; + case android.R.id.home: + finish(); + Intent intent = new Intent(this, MainActivity.class); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + return true; + default: + return super.onOptionsItemSelected(item); } } @@ -124,11 +126,11 @@ private void createGist() { String enteredDescription = descriptionText.getText().toString().trim(); final String description = enteredDescription.length() > 0 ? enteredDescription - : getString(R.string.gist_description_hint); + : getString(R.string.gist_description_hint); String enteredName = nameText.getText().toString().trim(); final String name = enteredName.length() > 0 ? enteredName - : getString(R.string.gist_file_name_hint); + : getString(R.string.gist_file_name_hint); final String content = contentText.getText().toString(); diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java b/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java index 72302fc17..7957a6229 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java @@ -56,7 +56,7 @@ public class GistFilesViewActivity extends PagerActivity { */ public static Intent createIntent(Gist gist, int position) { return new Builder("gist.files.VIEW").gist(gist.getId()) - .add(EXTRA_POSITION, position).toIntent(); + .add(EXTRA_POSITION, position).toIntent(); } private String gistId; @@ -91,6 +91,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.pager_with_title); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + pager = finder.find(R.id.vp_pages); loadingBar = finder.find(R.id.pb_loading); indicator = finder.find(R.id.tpi_header); @@ -148,16 +150,16 @@ private void configurePager() { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - if (gist != null) { - Intent intent = GistsViewActivity.createIntent(gist); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP + case android.R.id.home: + if (gist != null) { + Intent intent = GistsViewActivity.createIntent(gist); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - } - return true; - default: - return super.onOptionsItemSelected(item); + startActivity(intent); + } + return true; + default: + return super.onOptionsItemSelected(item); } } diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java index a4718a208..5e0d163f1 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java @@ -1,15 +1,10 @@ package com.github.mobile.ui.gist; -import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; -import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; import static com.github.mobile.util.TypefaceUtils.ICON_PERSON; import static com.github.mobile.util.TypefaceUtils.ICON_STAR; import static com.github.mobile.util.TypefaceUtils.ICON_TEAM; -import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.v7.app.ActionBar; -import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -18,9 +13,6 @@ import com.github.mobile.R; import com.github.mobile.ui.TabPagerFragment; -/** - * Created by Henrik on 2015-01-07. - */ public class GistsPagerFragment extends TabPagerFragment { @Override diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java index 72c559093..dbd9cfde6 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java @@ -48,7 +48,7 @@ * Activity to display a collection of Gists in a pager */ public class GistsViewActivity extends PagerActivity implements - OnLoadListener { + OnLoadListener { private static final int REQUEST_CONFIRM_DELETE = 1; @@ -60,7 +60,7 @@ public class GistsViewActivity extends PagerActivity implements */ public static Intent createIntent(Gist gist) { return new Builder("gists.VIEW").gist(gist).add(EXTRA_POSITION, 0) - .toIntent(); + .toIntent(); } /** @@ -76,8 +76,8 @@ public static Intent createIntent(List gists, int position) { for (Gist gist : gists) ids[index++] = gist.getId(); return new Builder("gists.VIEW") - .add(EXTRA_GIST_IDS, (Serializable) ids) - .add(EXTRA_POSITION, position).toIntent(); + .add(EXTRA_GIST_IDS, (Serializable) ids) + .add(EXTRA_POSITION, position).toIntent(); } private ViewPager pager; @@ -102,6 +102,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.pager); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + gists = getStringArrayExtra(EXTRA_GIST_IDS); gist = getSerializableExtra(EXTRA_GIST); initialPosition = getIntExtra(EXTRA_POSITION); @@ -130,22 +132,22 @@ protected void onCreate(Bundle savedInstanceState) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - finish(); - Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - return true; - case R.id.m_delete: - String gistId = gists[pager.getCurrentItem()]; - Bundle args = new Bundle(); - args.putString(EXTRA_GIST_ID, gistId); - ConfirmDialogFragment.show(this, REQUEST_CONFIRM_DELETE, + case android.R.id.home: + finish(); + Intent intent = new Intent(this, MainActivity.class); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + return true; + case R.id.m_delete: + String gistId = gists[pager.getCurrentItem()]; + Bundle args = new Bundle(); + args.putString(EXTRA_GIST_ID, gistId); + ConfirmDialogFragment.show(this, REQUEST_CONFIRM_DELETE, getString(R.string.confirm_gist_delete_title), getString(R.string.confirm_gist_delete_message), args); - return true; - default: - return super.onOptionsItemSelected(item); + return true; + default: + return super.onOptionsItemSelected(item); } } @@ -158,7 +160,7 @@ public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { } adapter.onDialogResult(pager.getCurrentItem(), requestCode, resultCode, - arguments); + arguments); super.onDialogResult(requestCode, resultCode, arguments); } diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java b/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java index 85ae5ddab..b85d8f3fa 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java @@ -75,7 +75,7 @@ public class EditIssueActivity extends DialogFragmentActivity { */ public static Intent createIntent(Repository repository) { return createIntent(null, repository.getOwner().getLogin(), - repository.getName(), repository.getOwner()); + repository.getName(), repository.getOwner()); } /** @@ -88,8 +88,8 @@ public static Intent createIntent(Repository repository) { * @return intent */ public static Intent createIntent(final Issue issue, - final String repositoryOwner, final String repositoryName, - final User user) { + final String repositoryOwner, final String repositoryName, + final User user) { Builder builder = new Builder("repo.issues.edit.VIEW"); if (user != null) builder.add(EXTRA_USER, user); @@ -167,17 +167,19 @@ protected void onCreate(Bundle savedInstanceState) { issue = new Issue(); repository = RepositoryId.create( - intent.getStringExtra(EXTRA_REPOSITORY_OWNER), - intent.getStringExtra(EXTRA_REPOSITORY_NAME)); + intent.getStringExtra(EXTRA_REPOSITORY_OWNER), + intent.getStringExtra(EXTRA_REPOSITORY_NAME)); + + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (issue.getNumber() > 0) if (IssueUtils.isPullRequest(issue)) actionBar.setTitle(getString(R.string.pull_request_title) - + issue.getNumber()); + + issue.getNumber()); else actionBar.setTitle(getString(R.string.issue_title) - + issue.getNumber()); + + issue.getNumber()); else actionBar.setTitle(R.string.new_issue); actionBar.setSubtitle(repository.generateId()); @@ -202,22 +204,22 @@ public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { return; switch (requestCode) { - case ISSUE_MILESTONE_UPDATE: - issue.setMilestone(MilestoneDialogFragment.getSelected(arguments)); - updateMilestone(); - break; - case ISSUE_ASSIGNEE_UPDATE: - User assignee = AssigneeDialogFragment.getSelected(arguments); - if (assignee != null) - issue.setAssignee(assignee); - else - issue.setAssignee(new User().setLogin("")); - updateAssignee(); - break; - case ISSUE_LABELS_UPDATE: - issue.setLabels(LabelsDialogFragment.getSelected(arguments)); - updateLabels(); - break; + case ISSUE_MILESTONE_UPDATE: + issue.setMilestone(MilestoneDialogFragment.getSelected(arguments)); + updateMilestone(); + break; + case ISSUE_ASSIGNEE_UPDATE: + User assignee = AssigneeDialogFragment.getSelected(arguments); + if (assignee != null) + issue.setAssignee(assignee); + else + issue.setAssignee(new User().setLogin("")); + updateAssignee(); + break; + case ISSUE_LABELS_UPDATE: + issue.setLabels(LabelsDialogFragment.getSelected(arguments)); + updateLabels(); + break; } } @@ -240,8 +242,8 @@ private void showCollaboratorOptions() { public void onClick(View v) { if (milestoneDialog == null) milestoneDialog = new MilestoneDialog( - EditIssueActivity.this, ISSUE_MILESTONE_UPDATE, - repository, milestoneService); + EditIssueActivity.this, ISSUE_MILESTONE_UPDATE, + repository, milestoneService); milestoneDialog.show(issue.getMilestone()); } }); @@ -252,8 +254,8 @@ public void onClick(View v) { public void onClick(View v) { if (assigneeDialog == null) assigneeDialog = new AssigneeDialog(EditIssueActivity.this, - ISSUE_ASSIGNEE_UPDATE, repository, - collaboratorService); + ISSUE_ASSIGNEE_UPDATE, repository, + collaboratorService); assigneeDialog.show(issue.getAssignee()); } }); @@ -264,7 +266,7 @@ public void onClick(View v) { public void onClick(View v) { if (labelsDialog == null) labelsDialog = new LabelsDialog(EditIssueActivity.this, - ISSUE_LABELS_UPDATE, repository, labelService); + ISSUE_LABELS_UPDATE, repository, labelService); labelsDialog.show(issue.getLabels()); } }); @@ -282,7 +284,7 @@ private void updateMilestone() { float total = closed + milestone.getOpenIssues(); if (total > 0) { ((LayoutParams) milestoneClosed.getLayoutParams()).weight = closed - / total; + / total; milestoneClosed.setVisibility(VISIBLE); } else milestoneClosed.setVisibility(GONE); @@ -342,40 +344,40 @@ public boolean onCreateOptionsMenu(Menu options) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.m_apply: - issue.setTitle(titleText.getText().toString()); - issue.setBody(bodyText.getText().toString()); - if (issue.getNumber() > 0) - new EditIssueTask(this, repository, issue) { - - @Override - protected void onSuccess(Issue editedIssue) + case R.id.m_apply: + issue.setTitle(titleText.getText().toString()); + issue.setBody(bodyText.getText().toString()); + if (issue.getNumber() > 0) + new EditIssueTask(this, repository, issue) { + + @Override + protected void onSuccess(Issue editedIssue) throws Exception { - super.onSuccess(editedIssue); - - Intent intent = new Intent(); - intent.putExtra(EXTRA_ISSUE, editedIssue); - setResult(RESULT_OK, intent); - finish(); - } - }.edit(); - else - new CreateIssueTask(this, repository, issue) { - - @Override - protected void onSuccess(Issue created) throws Exception { - super.onSuccess(created); - - Intent intent = new Intent(); - intent.putExtra(EXTRA_ISSUE, created); - setResult(RESULT_OK, intent); - finish(); - } - - }.create(); - return true; - default: - return super.onOptionsItemSelected(item); + super.onSuccess(editedIssue); + + Intent intent = new Intent(); + intent.putExtra(EXTRA_ISSUE, editedIssue); + setResult(RESULT_OK, intent); + finish(); + } + }.edit(); + else + new CreateIssueTask(this, repository, issue) { + + @Override + protected void onSuccess(Issue created) throws Exception { + super.onSuccess(created); + + Intent intent = new Intent(); + intent.putExtra(EXTRA_ISSUE, created); + setResult(RESULT_OK, intent); + finish(); + } + + }.create(); + return true; + default: + return super.onOptionsItemSelected(item); } } @@ -385,7 +387,7 @@ private void checkCollaboratorStatus() { @Override public Boolean run(Account account) throws Exception { return collaboratorService.isCollaborator( - repository, AccountUtils.getLogin(EditIssueActivity.this)); + repository, AccountUtils.getLogin(EditIssueActivity.this)); } @Override diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java b/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java index 907719d43..3ce1f8a67 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java @@ -60,7 +60,7 @@ public class EditIssuesFilterActivity extends DialogFragmentActivity { */ public static Intent createIntent(IssueFilter filter) { return new Builder("repo.issues.filter.VIEW").add(EXTRA_ISSUE_FILTER, - filter).toIntent(); + filter).toIntent(); } private static final int REQUEST_LABELS = 1; @@ -110,14 +110,16 @@ protected void onCreate(Bundle savedInstanceState) { if (savedInstanceState != null) filter = (IssueFilter) savedInstanceState - .getSerializable(EXTRA_ISSUE_FILTER); + .getSerializable(EXTRA_ISSUE_FILTER); if (filter == null) filter = (IssueFilter) getIntent().getSerializableExtra( - EXTRA_ISSUE_FILTER); + EXTRA_ISSUE_FILTER); final Repository repository = filter.getRepository(); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(R.string.filter_issues_title); actionBar.setSubtitle(repository.generateId()); @@ -128,14 +130,14 @@ protected void onCreate(Bundle savedInstanceState) { public void onClick(View v) { if (assigneeDialog == null) assigneeDialog = new AssigneeDialog( - EditIssuesFilterActivity.this, REQUEST_ASSIGNEE, - repository, collaborators); + EditIssuesFilterActivity.this, REQUEST_ASSIGNEE, + repository, collaborators); assigneeDialog.show(filter.getAssignee()); } }; findViewById(R.id.tv_assignee_label) - .setOnClickListener(assigneeListener); + .setOnClickListener(assigneeListener); assigneeText.setOnClickListener(assigneeListener); OnClickListener milestoneListener = new OnClickListener() { @@ -143,14 +145,14 @@ public void onClick(View v) { public void onClick(View v) { if (milestoneDialog == null) milestoneDialog = new MilestoneDialog( - EditIssuesFilterActivity.this, REQUEST_MILESTONE, - repository, milestones); + EditIssuesFilterActivity.this, REQUEST_MILESTONE, + repository, milestones); milestoneDialog.show(filter.getMilestone()); } }; findViewById(R.id.tv_milestone_label) - .setOnClickListener(milestoneListener); + .setOnClickListener(milestoneListener); milestoneText.setOnClickListener(milestoneListener); OnClickListener labelsListener = new OnClickListener() { @@ -158,14 +160,14 @@ public void onClick(View v) { public void onClick(View v) { if (labelsDialog == null) labelsDialog = new LabelsDialog( - EditIssuesFilterActivity.this, REQUEST_LABELS, - repository, labels); + EditIssuesFilterActivity.this, REQUEST_LABELS, + repository, labels); labelsDialog.show(filter.getLabels()); } }; findViewById(R.id.tv_labels_label) - .setOnClickListener(labelsListener); + .setOnClickListener(labelsListener); labelsText.setOnClickListener(labelsListener); updateAssignee(); @@ -177,7 +179,7 @@ public void onClick(View v) { openButton.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, - boolean isChecked) { + boolean isChecked) { if (isChecked) filter.setOpen(true); } @@ -188,7 +190,7 @@ public void onCheckedChanged(CompoundButton buttonView, closedButton.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, - boolean isChecked) { + boolean isChecked) { if (isChecked) filter.setOpen(false); } @@ -209,14 +211,14 @@ public boolean onCreateOptionsMenu(Menu options) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.m_apply: - Intent intent = new Intent(); - intent.putExtra(EXTRA_ISSUE_FILTER, filter); - setResult(RESULT_OK, intent); - finish(); - return true; - default: - return super.onOptionsItemSelected(item); + case R.id.m_apply: + Intent intent = new Intent(); + intent.putExtra(EXTRA_ISSUE_FILTER, filter); + setResult(RESULT_OK, intent); + finish(); + return true; + default: + return super.onOptionsItemSelected(item); } } @@ -260,18 +262,18 @@ public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { return; switch (requestCode) { - case REQUEST_LABELS: - filter.setLabels(LabelsDialogFragment.getSelected(arguments)); - updateLabels(); - break; - case REQUEST_MILESTONE: - filter.setMilestone(MilestoneDialogFragment.getSelected(arguments)); - updateMilestone(); - break; - case REQUEST_ASSIGNEE: - filter.setAssignee(AssigneeDialogFragment.getSelected(arguments)); - updateAssignee(); - break; + case REQUEST_LABELS: + filter.setLabels(LabelsDialogFragment.getSelected(arguments)); + updateLabels(); + break; + case REQUEST_MILESTONE: + filter.setMilestone(MilestoneDialogFragment.getSelected(arguments)); + updateMilestone(); + break; + case REQUEST_ASSIGNEE: + filter.setAssignee(AssigneeDialogFragment.getSelected(arguments)); + updateAssignee(); + break; } } } diff --git a/app/src/main/java/com/github/mobile/ui/issue/FiltersViewActivity.java b/app/src/main/java/com/github/mobile/ui/issue/FiltersViewActivity.java index 60580ac7f..d2965cf57 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/FiltersViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/FiltersViewActivity.java @@ -65,6 +65,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.issues_filter_list); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(R.string.bookmarks); actionBar.setIcon(R.drawable.action_bookmark); diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java index 238fe7d40..cea8817b3 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java @@ -46,7 +46,7 @@ public class IssueBrowseActivity extends DialogFragmentActivity { */ public static Intent createIntent(IssueFilter filter) { return new Builder("repo.issues.VIEW").repo(filter.getRepository()) - .add(EXTRA_ISSUE_FILTER, filter).toIntent(); + .add(EXTRA_ISSUE_FILTER, filter).toIntent(); } private Repository repo; @@ -62,6 +62,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.repo_issue_list); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(repo.getName()); actionBar.setSubtitle(repo.getOwner().getLogin()); @@ -72,13 +74,13 @@ protected void onCreate(Bundle savedInstanceState) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - Intent intent = FiltersViewActivity.createIntent(); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - return true; - default: - return super.onOptionsItemSelected(item); + case android.R.id.home: + Intent intent = FiltersViewActivity.createIntent(); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + return true; + default: + return super.onOptionsItemSelected(item); } } } diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueSearchActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssueSearchActivity.java index 1551d0b0d..dda283ca4 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueSearchActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueSearchActivity.java @@ -70,17 +70,17 @@ public boolean onCreateOptionsMenu(Menu options) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.m_clear: - IssueSearchSuggestionsProvider.clear(this); - ToastUtils.show(this, R.string.search_history_cleared); - return true; - case android.R.id.home: - Intent intent = RepositoryViewActivity.createIntent(repository); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - return true; - default: - return super.onOptionsItemSelected(item); + case R.id.m_clear: + IssueSearchSuggestionsProvider.clear(this); + ToastUtils.show(this, R.string.search_history_cleared); + return true; + case android.R.id.home: + Intent intent = RepositoryViewActivity.createIntent(repository); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + return true; + default: + return super.onOptionsItemSelected(item); } } @@ -90,6 +90,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.issue_search); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + ActionBar actionBar = getSupportActionBar(); Bundle appData = getIntent().getBundleExtra(APP_DATA); if (appData != null) { @@ -102,7 +104,7 @@ protected void onCreate(Bundle savedInstanceState) { avatars.bind(actionBar, repository.getOwner()); issueFragment = (SearchIssueListFragment) getSupportFragmentManager() - .findFragmentById(android.R.id.list); + .findFragmentById(android.R.id.list); handleIntent(getIntent()); } diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java index 162a07aa4..45eb9ecda 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java @@ -80,7 +80,7 @@ public static Intent createIntent(final Issue issue) { * @return intent */ public static Intent createIntent(final Issue issue, - final Repository repository) { + final Repository repository) { return createIntent(Collections.singletonList(issue), repository, 0); } @@ -93,7 +93,7 @@ public static Intent createIntent(final Issue issue, * @return intent */ public static Intent createIntent(final Collection issues, - final Repository repository, final int position) { + final Repository repository, final int position) { int[] numbers = new int[issues.size()]; boolean[] pullRequests = new boolean[issues.size()]; int index = 0; @@ -103,9 +103,9 @@ public static Intent createIntent(final Collection issues, index++; } return new Builder("issues.VIEW").add(EXTRA_ISSUE_NUMBERS, numbers) - .add(EXTRA_REPOSITORY, repository) - .add(EXTRA_POSITION, position) - .add(EXTRA_PULL_REQUESTS, pullRequests).toIntent(); + .add(EXTRA_REPOSITORY, repository) + .add(EXTRA_POSITION, position) + .add(EXTRA_PULL_REQUESTS, pullRequests).toIntent(); } /** @@ -116,11 +116,11 @@ public static Intent createIntent(final Collection issues, * @return intent */ public static Intent createIntent(Collection issues, - int position) { + int position) { final int count = issues.size(); int[] numbers = new int[count]; boolean[] pullRequests = new boolean[count]; - ArrayList repos = new ArrayList(count); + ArrayList repos = new ArrayList<>(count); int index = 0; for (Issue issue : issues) { numbers[index] = issue.getNumber(); @@ -130,12 +130,12 @@ public static Intent createIntent(Collection issues, RepositoryId repoId = null; if (issue instanceof RepositoryIssue) { Repository issueRepo = ((RepositoryIssue) issue) - .getRepository(); + .getRepository(); if (issueRepo != null) { User owner = issueRepo.getOwner(); if (owner != null) repoId = RepositoryId.create(owner.getLogin(), - issueRepo.getName()); + issueRepo.getName()); } } if (repoId == null) @@ -170,7 +170,7 @@ public static Intent createIntent(Collection issues, @Inject private CollaboratorService collaboratorService; - private final AtomicReference user = new AtomicReference(); + private final AtomicReference user = new AtomicReference<>(); private boolean isCollaborator; @@ -180,7 +180,6 @@ public static Intent createIntent(Collection issues, protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); issueNumbers = getIntArrayExtra(EXTRA_ISSUE_NUMBERS); pullRequests = getBooleanArrayExtra(EXTRA_PULL_REQUESTS); repoIds = getSerializableExtra(EXTRA_REPOSITORIES); @@ -188,6 +187,9 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.pager); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (repo != null) { ActionBar actionBar = getSupportActionBar(); actionBar.setSubtitle(repo.generateId()); @@ -198,16 +200,16 @@ protected void onCreate(Bundle savedInstanceState) { // Load avatar if single issue and user is currently unset or missing // avatar URL if (issueNumbers.length == 1 - && (user.get() == null || user.get().getAvatarUrl() == null)) + && (user.get() == null || user.get().getAvatarUrl() == null)) new RefreshRepositoryTask(this, repo != null ? repo : repoIds.get(0)) { @Override protected void onSuccess(Repository fullRepository) - throws Exception { + throws Exception { super.onSuccess(fullRepository); avatars.bind(getSupportActionBar(), - fullRepository.getOwner()); + fullRepository.getOwner()); } }.execute(); @@ -236,10 +238,10 @@ private void updateTitle(final int position) { if (pullRequest) getSupportActionBar().setTitle( - getString(R.string.pull_request_title) + number); + getString(R.string.pull_request_title) + number); else getSupportActionBar().setTitle( - getString(R.string.issue_title) + number); + getString(R.string.issue_title) + number); } @Override @@ -260,7 +262,7 @@ public void onPageSelected(final int position) { updateTitle(position); actionBar.setSubtitle(repoId.generateId()); RepositoryIssue issue = store.getIssue(repoId, - issueNumbers[position]); + issueNumbers[position]); if (issue != null) { Repository fullRepo = issue.getRepository(); if (fullRepo != null && fullRepo.getOwner() != null) { @@ -279,7 +281,7 @@ public void onPageSelected(final int position) { @Override public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { adapter.onDialogResult(pager.getCurrentItem(), requestCode, resultCode, - arguments); + arguments); } @Override @@ -311,27 +313,27 @@ public boolean onPrepareOptionsMenu(Menu menu) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - Repository repository = repo; - if (repository == null) { - int position = pager.getCurrentItem(); - RepositoryId repoId = repoIds.get(position); - if (repoId != null) { - RepositoryIssue issue = store.getIssue(repoId, + case android.R.id.home: + Repository repository = repo; + if (repository == null) { + int position = pager.getCurrentItem(); + RepositoryId repoId = repoIds.get(position); + if (repoId != null) { + RepositoryIssue issue = store.getIssue(repoId, issueNumbers[position]); - if (issue != null) - repository = issue.getRepository(); + if (issue != null) + repository = issue.getRepository(); + } } - } - if (repository != null) { - Intent intent = RepositoryViewActivity.createIntent(repository); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP + if (repository != null) { + Intent intent = RepositoryViewActivity.createIntent(repository); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - } - return true; - default: - return super.onOptionsItemSelected(item); + startActivity(intent); + } + return true; + default: + return super.onOptionsItemSelected(item); } } @@ -341,7 +343,7 @@ private void checkCollaboratorStatus() { @Override protected Boolean run(Account account) throws Exception { return collaboratorService.isCollaborator(repo != null ? repo : repoIds.get(0), - AccountUtils.getLogin(IssuesViewActivity.this)); + AccountUtils.getLogin(IssuesViewActivity.this)); } @Override diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java index 028f3f54f..7728c7b31 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java @@ -58,7 +58,7 @@ * Activity to view a file on a branch */ public class BranchFileViewActivity extends BaseActivity implements - LoaderCallbacks { + LoaderCallbacks { private static final String TAG = "BranchFileViewActivity"; @@ -76,7 +76,7 @@ public class BranchFileViewActivity extends BaseActivity implements * @return intent */ public static Intent createIntent(Repository repository, String branch, - String file, String blobSha) { + String file, String blobSha) { Builder builder = new Builder("branch.file.VIEW"); builder.repo(repository); builder.add(EXTRA_BASE, blobSha); @@ -133,7 +133,9 @@ protected void onCreate(Bundle savedInstanceState) { isMarkdownFile = MarkdownUtils.isMarkdown(file); editor = new SourceEditor(codeView); editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean( - WRAP, false)); + WRAP, false)); + + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(file); @@ -158,7 +160,7 @@ public boolean onCreateOptionsMenu(final Menu optionsMenu) { markdownItem.setEnabled(blob != null); markdownItem.setVisible(true); if (PreferenceUtils.getCodePreferences(this).getBoolean( - RENDER_MARKDOWN, true)) + RENDER_MARKDOWN, true)) markdownItem.setTitle(R.string.show_raw_markdown); else markdownItem.setTitle(R.string.render_markdown); @@ -170,39 +172,39 @@ public boolean onCreateOptionsMenu(final Menu optionsMenu) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.m_wrap: - if (editor.getWrap()) - item.setTitle(R.string.enable_wrapping); - else - item.setTitle(R.string.disable_wrapping); - editor.toggleWrap(); - PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) - .edit().putBoolean(WRAP, editor.getWrap())); - return true; - - case R.id.m_share: - shareFile(); - return true; - - case R.id.m_render_markdown: - if (editor.isMarkdown()) { - item.setTitle(R.string.render_markdown); - editor.toggleMarkdown(); - editor.setSource(file, blob); - } else { - item.setTitle(R.string.show_raw_markdown); - editor.toggleMarkdown(); - if (renderedMarkdown != null) - editor.setSource(file, renderedMarkdown, false); + case R.id.m_wrap: + if (editor.getWrap()) + item.setTitle(R.string.enable_wrapping); else - loadMarkdown(); - } - PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) + item.setTitle(R.string.disable_wrapping); + editor.toggleWrap(); + PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) + .edit().putBoolean(WRAP, editor.getWrap())); + return true; + + case R.id.m_share: + shareFile(); + return true; + + case R.id.m_render_markdown: + if (editor.isMarkdown()) { + item.setTitle(R.string.render_markdown); + editor.toggleMarkdown(); + editor.setSource(file, blob); + } else { + item.setTitle(R.string.show_raw_markdown); + editor.toggleMarkdown(); + if (renderedMarkdown != null) + editor.setSource(file, renderedMarkdown, false); + else + loadMarkdown(); + } + PreferenceUtils.save(PreferenceUtils.getCodePreferences(this) .edit().putBoolean(RENDER_MARKDOWN, editor.isMarkdown())); - return true; + return true; - default: - return super.onOptionsItemSelected(item); + default: + return super.onOptionsItemSelected(item); } } @@ -210,13 +212,13 @@ public boolean onOptionsItemSelected(MenuItem item) { public Loader onCreateLoader(int loader, Bundle args) { final String raw = args.getString(ARG_TEXT); final IRepositoryIdProvider repo = (IRepositoryIdProvider) args - .getSerializable(ARG_REPO); + .getSerializable(ARG_REPO); return new MarkdownLoader(this, repo, raw, imageGetter, false); } @Override public void onLoadFinished(Loader loader, - CharSequence rendered) { + CharSequence rendered) { if (rendered == null) ToastUtils.show(this, R.string.error_rendering_markdown); @@ -238,7 +240,7 @@ public void onLoaderReset(Loader loader) { private void shareFile() { String id = repo.generateId(); startActivity(ShareUtils.create(path + " at " + branch + " on " + id, - "https://github.com/" + id + "/blob/" + branch + '/' + path)); + "https://github.com/" + id + "/blob/" + branch + '/' + path)); } private void loadMarkdown() { @@ -246,7 +248,7 @@ private void loadMarkdown() { ViewUtils.setGone(codeView, true); String markdown = new String( - EncodingUtils.fromBase64(blob.getContent())); + EncodingUtils.fromBase64(blob.getContent())); Bundle args = new Bundle(); args.putCharSequence(ARG_TEXT, markdown); args.putSerializable(ARG_REPO, repo); @@ -269,9 +271,9 @@ protected void onSuccess(Blob blob) throws Exception { markdownItem.setEnabled(true); if (isMarkdownFile - && PreferenceUtils.getCodePreferences( - BranchFileViewActivity.this).getBoolean( - RENDER_MARKDOWN, true)) + && PreferenceUtils.getCodePreferences( + BranchFileViewActivity.this).getBoolean( + RENDER_MARKDOWN, true)) loadMarkdown(); else { ViewUtils.setGone(loadingBar, true); @@ -290,7 +292,7 @@ protected void onException(Exception e) throws RuntimeException { ViewUtils.setGone(loadingBar, true); ViewUtils.setGone(codeView, false); ToastUtils.show(BranchFileViewActivity.this, e, - R.string.error_file_load); + R.string.error_file_load); } }.execute(); } diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsActivity.java index d0a15a78f..5b13df83b 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsActivity.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsActivity.java @@ -60,6 +60,8 @@ protected void onCreate(Bundle savedInstanceState) { repository = getSerializableExtra(EXTRA_REPOSITORY); + setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(repository.getName()); actionBar.setSubtitle(R.string.contributors); @@ -72,13 +74,13 @@ protected void onCreate(Bundle savedInstanceState) { @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - Intent intent = RepositoryViewActivity.createIntent(repository); - intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); - startActivity(intent); - return true; - default: - return super.onOptionsItemSelected(item); + case android.R.id.home: + Intent intent = RepositoryViewActivity.createIntent(repository); + intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); + startActivity(intent); + return true; + default: + return super.onOptionsItemSelected(item); } } } diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java index c6917e2e9..029eadc6d 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java +++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java @@ -36,6 +36,8 @@ import com.github.mobile.ui.HeaderFooterListAdapter; import com.github.mobile.ui.ItemListFragment; import com.github.mobile.ui.LightAlertDialog; +import com.github.mobile.ui.user.OrganizationSelectionListener; +import com.github.mobile.ui.user.OrganizationSelectionProvider; import com.github.mobile.ui.user.UserViewActivity; import com.github.mobile.util.AvatarLoader; import com.google.inject.Inject; @@ -50,7 +52,8 @@ /** * Fragment to display a list of {@link Repository} instances */ -public class RepositoryListFragment extends ItemListFragment { +public class RepositoryListFragment extends ItemListFragment + implements OrganizationSelectionListener { @Inject private AccountDataManager cache; @@ -79,12 +82,47 @@ protected void configureList(Activity activity, ListView listView) { updateHeaders(items); } + @Override + public void onDetach() { + if (getActivity() != null && getActivity() instanceof OrganizationSelectionProvider) { + OrganizationSelectionProvider selectionProvider = (OrganizationSelectionProvider) getActivity(); + selectionProvider.removeListener(this); + } + + super.onDetach(); + } + + @Override + public void onOrganizationSelected(final User organization) { + User previousOrg = org.get(); + int previousOrgId = previousOrg != null ? previousOrg.getId() : -1; + org.set(organization); + + if (recentRepos != null) + recentRepos.saveAsync(); + + // Only hard refresh if view already created and org is changing + if (previousOrgId != organization.getId()) { + Activity activity = getActivity(); + if (activity != null) + recentRepos = new RecentRepositories(activity, organization); + + refreshWithProgress(); + } + } + @Override public void onActivityCreated(Bundle savedInstanceState) { Activity activity = getActivity(); -/* User currentOrg = ((OrganizationSelectionProvider) activity) - .addListener(this);*/ - User currentOrg = (User) getArguments().getSerializable("org"); + User currentOrg = null; + + if (getActivity() instanceof OrganizationSelectionProvider) + currentOrg = ((OrganizationSelectionProvider) activity) + .addListener(this); + + if (getArguments() != null && getArguments().containsKey("org")) + currentOrg = (User) getArguments().getSerializable("org"); + if (currentOrg == null && savedInstanceState != null) currentOrg = (User) savedInstanceState.getSerializable(EXTRA_USER); org.set(currentOrg); @@ -114,12 +152,12 @@ public void onListItemClick(ListView list, View v, int position, long id) { recentRepos.add(repo); startActivityForResult(RepositoryViewActivity.createIntent(repo), - REPOSITORY_VIEW); + REPOSITORY_VIEW); } @Override public boolean onListItemLongClick(ListView list, View v, int position, - long itemId) { + long itemId) { if (!isUsable()) return false; @@ -133,7 +171,7 @@ public boolean onListItemLongClick(ListView list, View v, int position, dialog.setTitle(repo.generateId()); View view = getActivity().getLayoutInflater().inflate( - R.layout.repo_dialog, null); + R.layout.repo_dialog, null); ViewFinder finder = new ViewFinder(view); final User owner = repo.getOwner(); @@ -187,7 +225,7 @@ private void updateHeaders(final List repos) { return; DefaultRepositoryListAdapter adapter = (DefaultRepositoryListAdapter) rootAdapter - .getWrappedAdapter(); + .getWrappedAdapter(); adapter.clearHeaders(); if (repos.isEmpty()) @@ -219,7 +257,7 @@ private void updateHeaders(final List repos) { current = repos.get(index); char start = Character.toLowerCase(current.getName().charAt(0)); adapter.registerHeader(current, - Character.toString(start).toUpperCase(US)); + Character.toString(start).toUpperCase(US)); char previousHeader = start; for (index = index + 1; index < repos.size(); index++) { @@ -234,7 +272,7 @@ private void updateHeaders(final List repos) { adapter.registerNoSeparator(repos.get(index - 1)); adapter.registerHeader(current, Character.toString(repoStart) - .toUpperCase(US)); + .toUpperCase(US)); previousHeader = repoStart; start = repoStart++; } @@ -254,7 +292,7 @@ public List loadData() throws Exception { return Collections.emptyList(); List repos = cache.getRepos(org, - isForceRefresh(args)); + isForceRefresh(args)); Collections.sort(repos, recentRepos); updateHeaders(repos); return repos; @@ -265,8 +303,8 @@ public List loadData() throws Exception { @Override protected SingleTypeAdapter createAdapter(List items) { return new DefaultRepositoryListAdapter(getActivity() - .getLayoutInflater(), - items.toArray(new Repository[items.size()]), org); + .getLayoutInflater(), + items.toArray(new Repository[items.size()]), org); } @Override diff --git a/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java b/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java index 0af40b72d..c5cf8ad44 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java +++ b/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java @@ -27,7 +27,8 @@ /** * Fragment to display a news feed for a given user/org */ -public abstract class UserNewsFragment extends NewsFragment { +public abstract class UserNewsFragment extends NewsFragment implements + OrganizationSelectionListener { /** * Current organization/user @@ -44,13 +45,28 @@ public void onSaveInstanceState(Bundle outState) { @Override public void onActivityCreated(Bundle savedInstanceState) { - org = (User) getArguments().getSerializable("org"); + if (getActivity() instanceof OrganizationSelectionProvider) + org = ((OrganizationSelectionProvider) getActivity()).addListener(this); + + if (getArguments() != null && getArguments().containsKey("org")) + org = (User) getArguments().getSerializable("org"); + if (org == null && savedInstanceState != null) org = (User) savedInstanceState.get(EXTRA_USER); super.onActivityCreated(savedInstanceState); } + @Override + public void onDetach() { + if (getActivity() != null && getActivity() instanceof OrganizationSelectionProvider) { + OrganizationSelectionProvider selectionProvider = (OrganizationSelectionProvider) getActivity(); + selectionProvider.removeListener(this); + } + + super.onDetach(); + } + @Override protected void viewRepository(Repository repository) { User owner = repository.getOwner(); @@ -60,6 +76,15 @@ protected void viewRepository(Repository repository) { super.viewRepository(repository); } + @Override + public void onOrganizationSelected(User organization) { + int previousOrgId = org != null ? org.getId() : -1; + org = organization; + // Only hard refresh if view already created and org is changing + if (previousOrgId != org.getId()) + refreshWithProgress(); + } + @Override protected boolean viewUser(User user) { if (org.getId() != user.getId()) { diff --git a/integration-tests/src/main/java/com/github/mobile/tests/FiltersViewActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/FiltersViewActivityTest.java index 6f4aeb113..28d82c59c 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/FiltersViewActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/FiltersViewActivityTest.java @@ -23,7 +23,7 @@ public class FiltersViewActivityTest extends ActivityTest { /** - * Create test + * Create navigation_drawer_header_background */ public FiltersViewActivityTest() { super(FiltersViewActivity.class); diff --git a/integration-tests/src/main/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java index 6e1f9fb1f..3337c5f07 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java @@ -30,10 +30,10 @@ * Tests of {@link CreateCommentActivity} */ public class CreateCommentActivityTest extends - ActivityTest { + ActivityTest { /** - * Create test + * Create navigation_drawer_header_background */ public CreateCommentActivityTest() { super(CreateCommentActivity.class); diff --git a/integration-tests/src/main/java/com/github/mobile/tests/commit/DiffStylerTest.java b/integration-tests/src/main/java/com/github/mobile/tests/commit/DiffStylerTest.java index 66ea5b3d1..b222d5db0 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/commit/DiffStylerTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/commit/DiffStylerTest.java @@ -59,9 +59,9 @@ private void compareStyled(String patch) throws IOException { public void testEmptyFiles() { DiffStyler styler = new DiffStyler(getContext().getResources()); styler.setFiles(null); - assertTrue(styler.get("test").isEmpty()); - styler.setFiles(Collections. emptyList()); - assertTrue(styler.get("test").isEmpty()); + assertTrue(styler.get("navigation_drawer_header_background").isEmpty()); + styler.setFiles(Collections.emptyList()); + assertTrue(styler.get("navigation_drawer_header_background").isEmpty()); } /** @@ -92,7 +92,7 @@ public void testOnlyNewline() throws IOException { * @throws IOException */ public void testEmptyPatchLineWithOtherValidLines() throws IOException { - compareStyled("@@ 0,1 0,1 @@\n\n-test\n"); + compareStyled("@@ 0,1 0,1 @@\n\n-navigation_drawer_header_background\n"); } /** @@ -101,7 +101,7 @@ public void testEmptyPatchLineWithOtherValidLines() throws IOException { * @throws IOException */ public void testTrailingEmptyLine() throws IOException { - compareStyled("@@ 0,1 0,1 @@\n-test\n\n"); + compareStyled("@@ 0,1 0,1 @@\n-navigation_drawer_header_background\n\n"); } /** @@ -119,7 +119,7 @@ public void testOnlyNewlines() throws IOException { * @throws IOException */ public void testNoTrailingNewlineAfterSecondLine() throws IOException { - compareStyled("@@ 1,2 1,2 @@\n+test"); + compareStyled("@@ 1,2 1,2 @@\n+navigation_drawer_header_background"); } /** @@ -137,6 +137,6 @@ public void testNoTrailingNewline() throws IOException { * @throws IOException */ public void testFormattedPatch() throws IOException { - compareStyled("@@ 1,2 1,2 @@\n+test\n"); + compareStyled("@@ 1,2 1,2 @@\n+navigation_drawer_header_background\n"); } } diff --git a/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java index 58b48657e..40ffda7c9 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java @@ -30,10 +30,10 @@ * Tests of {@link CreateCommentActivity} */ public class CreateCommentActivityTest extends - ActivityTest { + ActivityTest { /** - * Create test + * Create navigation_drawer_header_background */ public CreateCommentActivityTest() { super(CreateCommentActivity.class); @@ -44,7 +44,7 @@ protected void setUp() throws Exception { super.setUp(); setActivityIntent(CreateCommentActivity.createIntent(new Gist().setId( - "123").setUser(new User().setLogin("abc")))); + "123").setUser(new User().setLogin("abc")))); } /** diff --git a/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateGistActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateGistActivityTest.java index d69e2c463..d3a764722 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateGistActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/gist/CreateGistActivityTest.java @@ -30,7 +30,7 @@ public class CreateGistActivityTest extends ActivityTest { /** - * Create test + * Create navigation_drawer_header_background */ public CreateGistActivityTest() { super(CreateGistActivity.class); diff --git a/integration-tests/src/main/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java index 5b72658da..10ca670da 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java @@ -35,7 +35,7 @@ * Tests of {@link GistFilesViewActivity} */ public class GistFilesViewActivityTest extends - ActivityTest { + ActivityTest { @Inject private GistStore store; @@ -43,7 +43,7 @@ public class GistFilesViewActivityTest extends private Gist gist; /** - * Create test + * Create navigation_drawer_header_background */ public GistFilesViewActivityTest() { super(GistFilesViewActivity.class); @@ -54,11 +54,11 @@ protected void setUp() throws Exception { super.setUp(); RoboGuice.injectMembers(getInstrumentation().getTargetContext() - .getApplicationContext(), this); + .getApplicationContext(), this); gist = new Gist(); gist.setId("abcd"); - Map files = new LinkedHashMap(); + Map files = new LinkedHashMap<>(); files.put("a", new GistFile().setFilename("a").setContent("aa")); files.put("b", new GistFile().setFilename("b").setContent("bb")); gist.setFiles(files); @@ -73,7 +73,7 @@ protected void setUp() throws Exception { */ public void testChangingPages() throws Throwable { final ViewPager pager = (ViewPager) getActivity().findViewById( - id.vp_pages); + id.vp_pages); assertEquals(0, pager.getCurrentItem()); ui(new Runnable() { diff --git a/integration-tests/src/main/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java index d6376041a..d62149222 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java @@ -30,10 +30,10 @@ * Tests of {@link CreateCommentActivity} */ public class CreateCommentActivityTest extends - ActivityTest { + ActivityTest { /** - * Create test + * Create navigation_drawer_header_background */ public CreateCommentActivityTest() { super(CreateCommentActivity.class); @@ -44,7 +44,7 @@ protected void setUp() throws Exception { super.setUp(); setActivityIntent(CreateCommentActivity.createIntent(new RepositoryId( - "o", "n"), 1, new User().setLogin("u"))); + "o", "n"), 1, new User().setLogin("u"))); } /** diff --git a/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssueActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssueActivityTest.java index cc219c174..38c262b29 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssueActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssueActivityTest.java @@ -32,7 +32,7 @@ public class EditIssueActivityTest extends ActivityTest { /** - * Create test + * Create navigation_drawer_header_background */ public EditIssueActivityTest() { super(EditIssueActivity.class); diff --git a/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssuesFilterActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssuesFilterActivityTest.java index 7954ff025..18ca96e02 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssuesFilterActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/issue/EditIssuesFilterActivityTest.java @@ -26,10 +26,10 @@ * Tests of {@link EditIssuesFilterActivity} */ public class EditIssuesFilterActivityTest extends - ActivityTest { + ActivityTest { /** - * Create test + * Create navigation_drawer_header_background */ public EditIssuesFilterActivityTest() { super(EditIssuesFilterActivity.class); diff --git a/integration-tests/src/main/java/com/github/mobile/tests/ref/RefUtilsTest.java b/integration-tests/src/main/java/com/github/mobile/tests/ref/RefUtilsTest.java index f5931e121..115c2a485 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/ref/RefUtilsTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/ref/RefUtilsTest.java @@ -33,7 +33,7 @@ public void testIsBranch() { assertFalse(RefUtils.isBranch(null)); assertFalse(RefUtils.isBranch(new Reference())); assertFalse(RefUtils.isBranch(new Reference().setRef(""))); - assertFalse(RefUtils.isBranch(new Reference().setRef("test"))); + assertFalse(RefUtils.isBranch(new Reference().setRef("navigation_drawer_header_background"))); assertFalse(RefUtils.isBranch(new Reference().setRef("refs/tags/v1"))); assertFalse(RefUtils.isBranch(new Reference().setRef("refs/b1"))); assertTrue(RefUtils.isBranch(new Reference().setRef("refs/heads/b2"))); @@ -46,7 +46,7 @@ public void testIsTag() { assertFalse(RefUtils.isTag((Reference) null)); assertFalse(RefUtils.isTag(new Reference())); assertFalse(RefUtils.isTag(new Reference().setRef(""))); - assertFalse(RefUtils.isTag(new Reference().setRef("test"))); + assertFalse(RefUtils.isTag(new Reference().setRef("navigation_drawer_header_background"))); assertFalse(RefUtils.isTag(new Reference().setRef("refs/b1"))); assertFalse(RefUtils.isTag(new Reference().setRef("refs/heads/b2"))); assertTrue(RefUtils.isTag(new Reference().setRef("refs/tags/v1"))); @@ -60,9 +60,9 @@ public void testIsValid() { assertFalse(RefUtils.isValid(new Reference())); assertFalse(RefUtils.isValid(new Reference().setRef(""))); assertFalse(RefUtils.isValid(new Reference() - .setRef("refs/pull/6/merge"))); + .setRef("refs/pull/6/merge"))); assertFalse(RefUtils - .isValid(new Reference().setRef("refs/pull/6/head"))); + .isValid(new Reference().setRef("refs/pull/6/head"))); assertTrue(RefUtils.isValid(new Reference().setRef("refs/pull"))); assertTrue(RefUtils.isValid(new Reference().setRef("refs/heads/b1"))); assertTrue(RefUtils.isValid(new Reference().setRef("refs/tags/v1"))); @@ -76,13 +76,13 @@ public void testGetName() { assertNull(RefUtils.getName(new Reference())); assertEquals("", RefUtils.getName(new Reference().setRef(""))); assertEquals("unchanged", - RefUtils.getName(new Reference().setRef("unchanged"))); + RefUtils.getName(new Reference().setRef("unchanged"))); assertEquals("branch", - RefUtils.getName(new Reference().setRef("refs/heads/branch"))); + RefUtils.getName(new Reference().setRef("refs/heads/branch"))); assertEquals("tag", - RefUtils.getName(new Reference().setRef("refs/tags/tag"))); + RefUtils.getName(new Reference().setRef("refs/tags/tag"))); assertEquals("notes", - RefUtils.getName(new Reference().setRef("refs/notes"))); + RefUtils.getName(new Reference().setRef("refs/notes"))); } @@ -94,13 +94,13 @@ public void testGetPath() { assertNull(RefUtils.getPath(new Reference())); assertEquals("", RefUtils.getPath(new Reference().setRef(""))); assertEquals("unchanged", - RefUtils.getPath(new Reference().setRef("unchanged"))); + RefUtils.getPath(new Reference().setRef("unchanged"))); assertEquals("heads/branch", - RefUtils.getPath(new Reference().setRef("refs/heads/branch"))); + RefUtils.getPath(new Reference().setRef("refs/heads/branch"))); assertEquals("tags/tag", - RefUtils.getPath(new Reference().setRef("refs/tags/tag"))); + RefUtils.getPath(new Reference().setRef("refs/tags/tag"))); assertEquals("notes", - RefUtils.getPath(new Reference().setRef("refs/notes"))); + RefUtils.getPath(new Reference().setRef("refs/notes"))); } } diff --git a/integration-tests/src/main/java/com/github/mobile/tests/repo/SearchActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/repo/SearchActivityTest.java index 1c7a53153..b3ea7062b 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/repo/SearchActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/repo/SearchActivityTest.java @@ -26,10 +26,10 @@ * Tests of {@link SearchActivity} */ public class SearchActivityTest extends - ActivityTest { + ActivityTest { /** - * Create test + * Create navigation_drawer_header_background */ public SearchActivityTest() { super(SearchActivity.class); @@ -39,6 +39,6 @@ public SearchActivityTest() { protected void setUp() throws Exception { super.setUp(); - setActivityIntent(new Intent(ACTION_SEARCH).putExtra(QUERY, "test")); + setActivityIntent(new Intent(ACTION_SEARCH).putExtra(QUERY, "navigation_drawer_header_background")); } } diff --git a/integration-tests/src/main/java/com/github/mobile/tests/user/LoginActivityTest.java b/integration-tests/src/main/java/com/github/mobile/tests/user/LoginActivityTest.java index 7e73fbe5d..8df1fbdcc 100644 --- a/integration-tests/src/main/java/com/github/mobile/tests/user/LoginActivityTest.java +++ b/integration-tests/src/main/java/com/github/mobile/tests/user/LoginActivityTest.java @@ -30,7 +30,7 @@ public class LoginActivityTest extends ActivityTest { /** - * Create test for {@link LoginActivity} + * Create navigation_drawer_header_background for {@link LoginActivity} */ public LoginActivityTest() { super(LoginActivity.class); @@ -41,7 +41,7 @@ public LoginActivityTest() { */ public void testHasAuthenticator() { assertTrue(AccountUtils.hasAuthenticator(AccountManager - .get(getActivity()))); + .get(getActivity()))); } /** From d74c23c27121c2e952f1b1493d22c0edb04cfc85 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sun, 11 Jan 2015 22:17:38 +0100 Subject: [PATCH 0408/1055] -Color tweaks -Currently selected item now has background -Navigation drawer width corrected --- app/res/drawable/drawer_item_selected.xml | 3 + .../navigation_drawer_list_item_selector.xml | 5 ++ app/res/layout/activity_main.xml | 2 +- .../navigation_drawer_list_item_image.xml | 7 +- .../navigation_drawer_list_item_text.xml | 7 +- .../navigation_drawer_list_subheader.xml | 2 +- app/res/values-sw360dp/dimens.xml | 4 ++ app/res/values-sw384dp/dimens.xml | 4 ++ app/res/values/colors.xml | 5 +- app/res/values/theme.xml | 6 +- .../mobile/ui/CheckableRelativeLayout.java | 44 ++++++++++++ .../mobile/ui/user/HomePagerAdapter.java | 72 ++++++------------- 12 files changed, 98 insertions(+), 63 deletions(-) create mode 100644 app/res/drawable/drawer_item_selected.xml create mode 100644 app/res/drawable/navigation_drawer_list_item_selector.xml create mode 100644 app/res/values-sw360dp/dimens.xml create mode 100644 app/res/values-sw384dp/dimens.xml create mode 100644 app/src/main/java/com/github/mobile/ui/CheckableRelativeLayout.java diff --git a/app/res/drawable/drawer_item_selected.xml b/app/res/drawable/drawer_item_selected.xml new file mode 100644 index 000000000..1d2098742 --- /dev/null +++ b/app/res/drawable/drawer_item_selected.xml @@ -0,0 +1,3 @@ + + \ No newline at end of file diff --git a/app/res/drawable/navigation_drawer_list_item_selector.xml b/app/res/drawable/navigation_drawer_list_item_selector.xml new file mode 100644 index 000000000..ea27672f2 --- /dev/null +++ b/app/res/drawable/navigation_drawer_list_item_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/res/layout/activity_main.xml b/app/res/layout/activity_main.xml index 844724940..8735ba354 100644 --- a/app/res/layout/activity_main.xml +++ b/app/res/layout/activity_main.xml @@ -27,7 +27,7 @@ - + android:layout_height="wrap_content" + android:background="@drawable/navigation_drawer_list_item_selector"> - \ No newline at end of file + \ No newline at end of file diff --git a/app/res/layout/navigation_drawer_list_item_text.xml b/app/res/layout/navigation_drawer_list_item_text.xml index d694f91c4..b9495081e 100644 --- a/app/res/layout/navigation_drawer_list_item_text.xml +++ b/app/res/layout/navigation_drawer_list_item_text.xml @@ -1,7 +1,8 @@ - + android:layout_height="wrap_content" + android:background="@drawable/navigation_drawer_list_item_selector"> - \ No newline at end of file + \ No newline at end of file diff --git a/app/res/layout/navigation_drawer_list_subheader.xml b/app/res/layout/navigation_drawer_list_subheader.xml index 3a05990fe..e8b66c787 100644 --- a/app/res/layout/navigation_drawer_list_subheader.xml +++ b/app/res/layout/navigation_drawer_list_subheader.xml @@ -7,7 +7,7 @@ android:text="@string/navigation_drawer_subheader" android:id="@+id/navigation_drawer_item_name" android:textAppearance="@style/TextAppearance.AppCompat.Body2" - android:textColor="@color/text_recent" + android:textColor="@color/accent" android:textSize="14sp" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" diff --git a/app/res/values-sw360dp/dimens.xml b/app/res/values-sw360dp/dimens.xml new file mode 100644 index 000000000..a3d1d52a1 --- /dev/null +++ b/app/res/values-sw360dp/dimens.xml @@ -0,0 +1,4 @@ + + + 304dp + \ No newline at end of file diff --git a/app/res/values-sw384dp/dimens.xml b/app/res/values-sw384dp/dimens.xml new file mode 100644 index 000000000..e2b38dc8a --- /dev/null +++ b/app/res/values-sw384dp/dimens.xml @@ -0,0 +1,4 @@ + + + 320dp + \ No newline at end of file diff --git a/app/res/values/colors.xml b/app/res/values/colors.xml index 01bf9ff1d..3d77d7c62 100644 --- a/app/res/values/colors.xml +++ b/app/res/values/colors.xml @@ -1,5 +1,4 @@ - - - diff --git a/app/src/main/java/com/github/mobile/ui/CheckableRelativeLayout.java b/app/src/main/java/com/github/mobile/ui/CheckableRelativeLayout.java new file mode 100644 index 000000000..19032bf8e --- /dev/null +++ b/app/src/main/java/com/github/mobile/ui/CheckableRelativeLayout.java @@ -0,0 +1,44 @@ +package com.github.mobile.ui; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.Checkable; +import android.widget.RelativeLayout; + +public class CheckableRelativeLayout extends RelativeLayout implements Checkable { + private static final int[] CheckedStateSet = { + android.R.attr.state_checked + }; + private boolean checked = false; + + public CheckableRelativeLayout(Context context) { + super(context, null); + } + + public CheckableRelativeLayout(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean b) { + checked = b; + refreshDrawableState(); + forceLayout(); + } + + public void toggle() { + checked = !checked; + } + + @Override + protected int[] onCreateDrawableState(int extraSpace) { + final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); + if (isChecked()) { + mergeDrawableStates(drawableState, CheckedStateSet); + } + return drawableState; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java b/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java index c395be2fa..d6a1dcec3 100644 --- a/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java @@ -19,9 +19,7 @@ import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; import android.support.v7.app.ActionBarActivity; -import android.util.Log; import android.view.ViewGroup; import com.github.mobile.R; @@ -66,20 +64,20 @@ public HomePagerAdapter(final ActionBarActivity activity, public Fragment getItem(int position) { Fragment fragment = null; switch (position) { - case 0: - fragment = defaultUser ? new UserReceivedNewsFragment() + case 0: + fragment = defaultUser ? new UserReceivedNewsFragment() : new OrganizationNewsFragment(); - break; - case 1: - fragment = new RepositoryListFragment(); - break; - case 2: - fragment = defaultUser ? new MyFollowersFragment() + break; + case 1: + fragment = new RepositoryListFragment(); + break; + case 2: + fragment = defaultUser ? new MyFollowersFragment() : new MembersFragment(); - break; - case 3: - fragment = new MyFollowingFragment(); - break; + break; + case 3: + fragment = new MyFollowingFragment(); + break; } if (fragment != null) { @@ -87,35 +85,9 @@ public Fragment getItem(int position) { args.putSerializable("org", org); fragment.setArguments(args); } - Log.d("TEST", "getItem ::" + position); return fragment; } - /** - * This methods clears any fragments that may not apply to the newly - * selected org. - * - * @param isDefaultUser - * @return this adapter - */ - public HomePagerAdapter clearAdapter(boolean isDefaultUser) { - defaultUser = isDefaultUser; - - if (tags.isEmpty()) - return this; - - FragmentTransaction transaction = fragmentManager.beginTransaction(); - for (String tag : tags) { - Fragment fragment = fragmentManager.findFragmentByTag(tag); - if (fragment != null) - transaction.remove(fragment); - } - transaction.commit(); - tags.clear(); - - return this; - } - @Override public int getItemPosition(Object object) { return POSITION_NONE; @@ -136,17 +108,17 @@ public int getCount() { @Override public CharSequence getPageTitle(int position) { switch (position) { - case 0: - return resources.getString(R.string.tab_news); - case 1: - return resources.getString(R.string.tab_repositories); - case 2: - return resources.getString(defaultUser ? R.string.tab_followers_self + case 0: + return resources.getString(R.string.tab_news); + case 1: + return resources.getString(R.string.tab_repositories); + case 2: + return resources.getString(defaultUser ? R.string.tab_followers_self : R.string.tab_members); - case 3: - return resources.getString(R.string.tab_following_self); - default: - return null; + case 3: + return resources.getString(R.string.tab_following_self); + default: + return null; } } } From 8b917689d440a980c7a2c5dd889c9cf53ec3b354 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sun, 11 Jan 2015 22:35:00 +0100 Subject: [PATCH 0409/1055] -Drawer header height and font fixed --- app/res/layout/fragment_navigation_drawer.xml | 28 +++++++++++-------- .../navigation_drawer_list_item_image.xml | 1 - .../navigation_drawer_list_item_text.xml | 1 - .../mobile/ui/NavigationDrawerFragment.java | 6 ++-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/res/layout/fragment_navigation_drawer.xml b/app/res/layout/fragment_navigation_drawer.xml index f7fa5f1a0..cb5990e9e 100644 --- a/app/res/layout/fragment_navigation_drawer.xml +++ b/app/res/layout/fragment_navigation_drawer.xml @@ -7,31 +7,37 @@ + + + android:layout_width="32dp" + android:layout_height="32dp" + android:id="@+id/user_picture" + android:layout_centerVertical="true" /> + android:layout_alignLeft="@+id/user_extra" + android:layout_alignStart="@+id/user_extra" + android:layout_above="@+id/user_extra" /> diff --git a/app/res/layout/navigation_drawer_list_item_text.xml b/app/res/layout/navigation_drawer_list_item_text.xml index b9495081e..55be74ecc 100644 --- a/app/res/layout/navigation_drawer_list_item_text.xml +++ b/app/res/layout/navigation_drawer_list_item_text.xml @@ -22,7 +22,6 @@ android:id="@+id/navigation_drawer_item_name" android:layout_marginLeft="72dp" android:layout_marginStart="72dp" - android:textSize="14sp" android:textColor="#212121" android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:layout_centerVertical="true" /> diff --git a/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java b/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java index d344fe187..c5ee7e10a 100644 --- a/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java +++ b/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java @@ -45,7 +45,7 @@ public class NavigationDrawerFragment extends Fragment implements AdapterView.On private ImageView userImage; private TextView userName; - private TextView userEmail; + private TextView userExtra; public NavigationDrawerFragment() { } @@ -89,7 +89,7 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); userImage = (ImageView) view.findViewById(R.id.user_picture); userName = (TextView) view.findViewById(R.id.user_name); - userEmail = (TextView) view.findViewById(R.id.user_email); + userExtra = (TextView) view.findViewById(R.id.user_extra); mDrawerListView = (ListView) view.findViewById(R.id.navigation_drawer_list); mDrawerListView.setOnItemClickListener(this); } @@ -106,7 +106,7 @@ public void setUp(int fragmentId, DrawerLayout drawerLayout, NavigationDrawerAda avatar.bind(userImage, user); userName.setText(user.getLogin()); - userEmail.setText(user.getEmail()); + userExtra.setText(user.getEmail()); mDrawerListView.setAdapter(adapter); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); From 68476700d31120f450b76287028621f5aaa67ddb Mon Sep 17 00:00:00 2001 From: Henrik Date: Mon, 12 Jan 2015 12:40:06 +0100 Subject: [PATCH 0410/1055] -Fixed crash -Removed "email"-TextView from navigation drawer header -Vertically centered username in navigation drawer header --- app/res/layout/fragment_navigation_drawer.xml | 21 +++---- .../mobile/ui/FragmentPagerAdapter.java | 16 ++++- .../mobile/ui/FragmentStatePagerAdapter.java | 15 ++++- .../mobile/ui/NavigationDrawerFragment.java | 3 - .../github/mobile/ui/TabPagerFragment.java | 7 --- .../ui/gist/GistQueriesPagerAdapter.java | 41 +++++++------ .../mobile/ui/gist/GistsPagerFragment.java | 2 +- .../ui/issue/IssueDashboardPagerAdapter.java | 59 +++++++++---------- .../ui/issue/IssueDashboardPagerFragment.java | 2 +- .../mobile/ui/user/HomePagerAdapter.java | 11 ++-- .../mobile/ui/user/HomePagerFragment.java | 2 +- 11 files changed, 89 insertions(+), 90 deletions(-) diff --git a/app/res/layout/fragment_navigation_drawer.xml b/app/res/layout/fragment_navigation_drawer.xml index cb5990e9e..bd014bbb5 100644 --- a/app/res/layout/fragment_navigation_drawer.xml +++ b/app/res/layout/fragment_navigation_drawer.xml @@ -17,31 +17,24 @@ android:src="@drawable/navigation_drawer_header_background" /> + android:layout_centerVertical="true" + android:layout_margin="16dp" /> - - + setGone(boolean gone) { return this; } - @Override - public void onDestroy() { - super.onDestroy(); - if (adapter instanceof FragmentPagerAdapter) - ((FragmentPagerAdapter) adapter).clearAdapter(); - } - /** * Set current item to new position *

diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistQueriesPagerAdapter.java b/app/src/main/java/com/github/mobile/ui/gist/GistQueriesPagerAdapter.java index b08a36819..e06f7b67c 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistQueriesPagerAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistQueriesPagerAdapter.java @@ -17,7 +17,6 @@ import android.content.res.Resources; import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBarActivity; import com.github.mobile.R; import com.github.mobile.ui.FragmentPagerAdapter; @@ -32,12 +31,12 @@ public class GistQueriesPagerAdapter extends FragmentPagerAdapter { /** * Create pager adapter * - * @param activity + * @param fragment */ - public GistQueriesPagerAdapter(ActionBarActivity activity) { - super(activity); + public GistQueriesPagerAdapter(Fragment fragment) { + super(fragment); - resources = activity.getResources(); + resources = fragment.getResources(); } @Override @@ -48,28 +47,28 @@ public int getCount() { @Override public Fragment getItem(int position) { switch (position) { - case 0: - return new MyGistsFragment(); - case 1: - return new StarredGistsFragment(); - case 2: - return new PublicGistsFragment(); - default: - return null; + case 0: + return new MyGistsFragment(); + case 1: + return new StarredGistsFragment(); + case 2: + return new PublicGistsFragment(); + default: + return null; } } @Override public CharSequence getPageTitle(int position) { switch (position) { - case 0: - return resources.getString(R.string.tab_mine); - case 1: - return resources.getString(R.string.tab_starred); - case 2: - return resources.getString(R.string.tab_all); - default: - return null; + case 0: + return resources.getString(R.string.tab_mine); + case 1: + return resources.getString(R.string.tab_starred); + case 2: + return resources.getString(R.string.tab_all); + default: + return null; } } } diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java b/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java index 5e0d163f1..5f1c617d0 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java +++ b/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java @@ -44,7 +44,7 @@ public boolean onOptionsItemSelected(MenuItem item) { @Override protected GistQueriesPagerAdapter createAdapter() { - return new GistQueriesPagerAdapter((android.support.v7.app.ActionBarActivity) getActivity()); + return new GistQueriesPagerAdapter(this); } @Override diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerAdapter.java b/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerAdapter.java index a695c810c..683770d33 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerAdapter.java @@ -28,7 +28,6 @@ import android.content.res.Resources; import android.os.Bundle; import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBarActivity; import com.github.mobile.R; import com.github.mobile.ui.FragmentStatePagerAdapter; @@ -47,12 +46,12 @@ public class IssueDashboardPagerAdapter extends FragmentStatePagerAdapter { /** * Create pager adapter * - * @param activity + * @param fragment */ - public IssueDashboardPagerAdapter(final ActionBarActivity activity) { - super(activity); + public IssueDashboardPagerAdapter(final Fragment fragment) { + super(fragment); - resources = activity.getResources(); + resources = fragment.getResources(); } @Override @@ -64,22 +63,22 @@ public int getCount() { public Fragment getItem(final int position) { String filter = null; switch (position) { - case 0: - filter = FILTER_SUBSCRIBED; - break; - case 1: - filter = FILTER_ASSIGNED; - break; - case 2: - filter = FILTER_CREATED; - break; - case 3: - filter = FILTER_MENTIONED; - break; - default: - return null; + case 0: + filter = FILTER_SUBSCRIBED; + break; + case 1: + filter = FILTER_ASSIGNED; + break; + case 2: + filter = FILTER_CREATED; + break; + case 3: + filter = FILTER_MENTIONED; + break; + default: + return null; } - final Map filterData = new HashMap(); + final Map filterData = new HashMap<>(); filterData.put(FIELD_FILTER, filter); filterData.put(FIELD_SORT, SORT_UPDATED); filterData.put(FIELD_DIRECTION, DIRECTION_DESCENDING); @@ -93,16 +92,16 @@ public Fragment getItem(final int position) { @Override public CharSequence getPageTitle(final int position) { switch (position) { - case 0: - return resources.getString(R.string.tab_watched); - case 1: - return resources.getString(R.string.tab_assigned); - case 2: - return resources.getString(R.string.tab_created); - case 3: - return resources.getString(R.string.tab_mentioned); - default: - return null; + case 0: + return resources.getString(R.string.tab_watched); + case 1: + return resources.getString(R.string.tab_assigned); + case 2: + return resources.getString(R.string.tab_created); + case 3: + return resources.getString(R.string.tab_mentioned); + default: + return null; } } } diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerFragment.java b/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerFragment.java index eaa5974d6..09051533f 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerFragment.java +++ b/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerFragment.java @@ -57,7 +57,7 @@ public boolean onOptionsItemSelected(MenuItem item) { @Override protected IssueDashboardPagerAdapter createAdapter() { - return new IssueDashboardPagerAdapter((android.support.v7.app.ActionBarActivity) getActivity()); + return new IssueDashboardPagerAdapter(this); } @Override diff --git a/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java b/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java index d6a1dcec3..f0959bd17 100644 --- a/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java @@ -19,7 +19,6 @@ import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; -import android.support.v7.app.ActionBarActivity; import android.view.ViewGroup; import com.github.mobile.R; @@ -47,16 +46,16 @@ public class HomePagerAdapter extends FragmentPagerAdapter { private final Set tags = new HashSet<>(); /** - * @param activity + * @param fragment * @param defaultUser */ - public HomePagerAdapter(final ActionBarActivity activity, + public HomePagerAdapter(final Fragment fragment, final boolean defaultUser, final User org) { - super(activity); + super(fragment); this.org = org; - fragmentManager = activity.getSupportFragmentManager(); - resources = activity.getResources(); + fragmentManager = fragment.getChildFragmentManager(); + resources = fragment.getResources(); this.defaultUser = defaultUser; } diff --git a/app/src/main/java/com/github/mobile/ui/user/HomePagerFragment.java b/app/src/main/java/com/github/mobile/ui/user/HomePagerFragment.java index 7cedd0ce2..21288406f 100644 --- a/app/src/main/java/com/github/mobile/ui/user/HomePagerFragment.java +++ b/app/src/main/java/com/github/mobile/ui/user/HomePagerFragment.java @@ -41,6 +41,6 @@ private void setOrg(User org) { @Override protected HomePagerAdapter createAdapter() { - return new HomePagerAdapter((android.support.v7.app.ActionBarActivity) getActivity(), isDefaultUser, org); + return new HomePagerAdapter(this, isDefaultUser, org); } } From 560d9804d0d0f34614daeecd41b551dcfac41126 Mon Sep 17 00:00:00 2001 From: Henrik Date: Mon, 12 Jan 2015 13:28:04 +0100 Subject: [PATCH 0411/1055] -Fixed unintentional removal of .gitignore and .travis.yml --- .gitignore | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 19 ++++++++ 2 files changed, 148 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..72c028f92 --- /dev/null +++ b/.gitignore @@ -0,0 +1,129 @@ +*/target +target +tmp +*~ +bin +*/test-output +temp-testng-customsuite.xml +**pom.xml.releaseBackup +release.properties +gen +*/seed.txt +notes +logs +gen-external-apklibs +.idea +*.iml +.DS_Store +*.swp +out +.gradle +/local.properties +/build + +###OSX### + +.DS_Store +.AppleDouble +.LSOverride + +# Icon must ends with two \r. +Icon + + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + + +###Linux### + +*~ + +# KDE directory preferences +.directory + + +###Android### + +# Built application files +*.apk +*.ap_ + +# Files for ART and Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ + +# Gradle files +.gradle/ +.gradletasknamecache +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Lint +lint-report.html +lint-report_files/ +lint_result.txt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + + +###IntelliJ### + +*.iml +*.ipr +*.iws +.idea/ + + +###Eclipse### + +*.pydevproject +.metadata +tmp/ +*.tmp +*.bak +*.swp +*~.nib +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +# sbteclipse plugin +.target + +# TeXlipse plugin +.texlipse \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..592f056ca --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: android +android: + components: + - platform-tools + - android-16 + - build-tools-21.1.2 + - extra + +jdk: oraclejdk7 + +notifications: + email: false + +before_install: + - sudo apt-get update -qq + - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi + +script: + - ./gradlew clean build \ No newline at end of file From f094fb7df326a8478288a1e55a02b1436b5cdbd3 Mon Sep 17 00:00:00 2001 From: Henrik Date: Tue, 13 Jan 2015 10:32:35 +0100 Subject: [PATCH 0412/1055] -Added Tab updater --- app/src/main/java/com/github/mobile/ui/TabPagerActivity.java | 4 ++++ app/src/main/java/com/github/mobile/ui/user/HomeActivity.java | 1 + 2 files changed, 5 insertions(+) diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index f93db1410..693acebd3 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -134,6 +134,9 @@ private void createPager() { adapter = createAdapter(); invalidateOptionsMenu(); pager.setAdapter(adapter); + } + + public void updateTabs() { slidingTabsLayout.setViewPager(pager); } @@ -143,6 +146,7 @@ private void createPager() { protected void configureTabPager() { if (adapter == null) { createPager(); + updateTabs(); } } diff --git a/app/src/main/java/com/github/mobile/ui/user/HomeActivity.java b/app/src/main/java/com/github/mobile/ui/user/HomeActivity.java index 4ebe38585..4395dc4c4 100644 --- a/app/src/main/java/com/github/mobile/ui/user/HomeActivity.java +++ b/app/src/main/java/com/github/mobile/ui/user/HomeActivity.java @@ -189,6 +189,7 @@ else if (changed) { if (item >= adapter.getCount()) item = adapter.getCount() - 1; pager.setItem(item); + updateTabs(); } for (OrganizationSelectionListener listener : orgSelectionListeners) From f1dd143241d2404cb2b76a821b10710fa01051b2 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Tue, 13 Jan 2015 18:52:44 +0700 Subject: [PATCH 0413/1055] Remove HomeActivity to make a successful build Many things refered in this class are already deleted. --- .../github/mobile/ui/user/HomeActivity.java | 301 ------------------ 1 file changed, 301 deletions(-) delete mode 100644 app/src/main/java/com/github/mobile/ui/user/HomeActivity.java diff --git a/app/src/main/java/com/github/mobile/ui/user/HomeActivity.java b/app/src/main/java/com/github/mobile/ui/user/HomeActivity.java deleted file mode 100644 index 4395dc4c4..000000000 --- a/app/src/main/java/com/github/mobile/ui/user/HomeActivity.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright 2012 GitHub Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.github.mobile.ui.user; - -import static com.github.mobile.ui.user.HomeDropdownListAdapter.ACTION_BOOKMARKS; -import static com.github.mobile.ui.user.HomeDropdownListAdapter.ACTION_DASHBOARD; -import static com.github.mobile.ui.user.HomeDropdownListAdapter.ACTION_GISTS; -import static com.github.mobile.util.TypefaceUtils.ICON_FOLLOW; -import static com.github.mobile.util.TypefaceUtils.ICON_NEWS; -import static com.github.mobile.util.TypefaceUtils.ICON_PUBLIC; -import static com.github.mobile.util.TypefaceUtils.ICON_TEAM; -import static com.github.mobile.util.TypefaceUtils.ICON_WATCH; -import android.app.SearchManager; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.support.v4.app.LoaderManager.LoaderCallbacks; -import android.support.v4.content.Loader; -import android.support.v4.view.MenuItemCompat; -import android.support.v7.app.ActionBar; -import android.support.v7.widget.SearchView; -import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.Window; - -import com.github.mobile.R; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.core.user.UserComparator; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.ui.TabPagerActivity; -import com.github.mobile.ui.gist.GistsActivity; -import com.github.mobile.ui.issue.FiltersViewActivity; -import com.github.mobile.ui.issue.IssueDashboardActivity; -import com.github.mobile.ui.repo.OrganizationLoader; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.PreferenceUtils; -import com.google.inject.Inject; -import com.google.inject.Provider; - -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.egit.github.core.User; - -/** - * Home screen activity - */ -public class HomeActivity extends TabPagerActivity implements - ActionBar.OnNavigationListener, OrganizationSelectionProvider, - LoaderCallbacks> { - - private static final String TAG = "HomeActivity"; - - private static final String PREF_ORG_ID = "orgId"; - - @Inject - private AccountDataManager accountDataManager; - - @Inject - private Provider userComparatorProvider; - - private boolean isDefaultUser; - - private List orgs = Collections.emptyList(); - - private HomeDropdownListAdapter homeAdapter; - - private Set orgSelectionListeners = new LinkedHashSet(); - - private User org; - - @Inject - private AvatarLoader avatars; - - @Inject - private SharedPreferences sharedPreferences; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - getSupportLoaderManager().initLoader(0, null, this); - } - - private void reloadOrgs() { - getSupportLoaderManager().restartLoader(0, null, - new LoaderCallbacks>() { - - @Override - public Loader> onCreateLoader(int id, - Bundle bundle) { - return HomeActivity.this.onCreateLoader(id, bundle); - } - - @Override - public void onLoadFinished(Loader> loader, - final List users) { - HomeActivity.this.onLoadFinished(loader, users); - if (users.isEmpty()) - return; - - Window window = getWindow(); - if (window == null) - return; - View view = window.getDecorView(); - if (view == null) - return; - - view.post(new Runnable() { - - @Override - public void run() { - isDefaultUser = false; - setOrg(users.get(0)); - } - }); - } - - @Override - public void onLoaderReset(Loader> loader) { - HomeActivity.this.onLoaderReset(loader); - } - }); - } - - @Override - protected void onResume() { - super.onResume(); - - // Restart loader if default account doesn't match currently loaded - // account - List currentOrgs = orgs; - if (currentOrgs != null && !currentOrgs.isEmpty() - && !AccountUtils.isUser(this, currentOrgs.get(0))) - reloadOrgs(); - } - - private void configureActionBar() { - ActionBar actionBar = getSupportActionBar(); - actionBar.setDisplayShowHomeEnabled(false); - actionBar.setDisplayShowTitleEnabled(false); - - // TODO This is now deprecated, should look at switching to child spinner view via Toolbar - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); - - homeAdapter = new HomeDropdownListAdapter(this, orgs, avatars); - actionBar.setListNavigationCallbacks(homeAdapter, this); - } - - private void setOrg(User org) { - Log.d(TAG, "setOrg : " + org.getLogin()); - - PreferenceUtils.save(sharedPreferences.edit().putInt(PREF_ORG_ID, - org.getId())); - - // Don't notify listeners or change pager if org hasn't changed - if (this.org != null && this.org.getId() == org.getId()) - return; - - this.org = org; - - boolean isDefaultUser = AccountUtils.isUser(this, org); - boolean changed = this.isDefaultUser != isDefaultUser; - this.isDefaultUser = isDefaultUser; - if (adapter == null) - configureTabPager(); - else if (changed) { - int item = pager.getCurrentItem(); - adapter.clearAdapter(isDefaultUser); - adapter.notifyDataSetChanged(); - if (item >= adapter.getCount()) - item = adapter.getCount() - 1; - pager.setItem(item); - updateTabs(); - } - - for (OrganizationSelectionListener listener : orgSelectionListeners) - listener.onOrganizationSelected(org); - } - - @Override - public boolean onCreateOptionsMenu(Menu optionMenu) { - getMenuInflater().inflate(R.menu.home, optionMenu); - - SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); - MenuItem searchItem = optionMenu.findItem(R.id.m_search); - SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); - searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); - - return super.onCreateOptionsMenu(optionMenu); - } - - @Override - public boolean onNavigationItemSelected(int itemPosition, long itemId) { - if (homeAdapter.isOrgPosition(itemPosition)) { - homeAdapter.setSelected(itemPosition); - setOrg(orgs.get(itemPosition)); - } else if (homeAdapter.getOrgCount() > 0) { - switch (homeAdapter.getAction(itemPosition)) { - case ACTION_GISTS: - startActivity(new Intent(this, GistsActivity.class)); - break; - case ACTION_DASHBOARD: - startActivity(new Intent(this, IssueDashboardActivity.class)); - break; - case ACTION_BOOKMARKS: - startActivity(FiltersViewActivity.createIntent()); - break; - } - int orgSelected = homeAdapter.getSelected(); - ActionBar actionBar = getSupportActionBar(); - if (orgSelected < actionBar.getNavigationItemCount()) - actionBar.setSelectedNavigationItem(orgSelected); - } - return true; - } - - @Override - public Loader> onCreateLoader(int i, Bundle bundle) { - return new OrganizationLoader(this, accountDataManager, - userComparatorProvider); - } - - @Override - public void onLoadFinished(Loader> listLoader, List orgs) { - this.orgs = orgs; - - if (homeAdapter != null) - homeAdapter.setOrgs(orgs); - else - configureActionBar(); - - int sharedPreferencesOrgId = sharedPreferences.getInt(PREF_ORG_ID, -1); - int targetOrgId = org == null ? sharedPreferencesOrgId : org.getId(); - - ActionBar actionBar = getSupportActionBar(); - for (int i = 0; i < orgs.size(); i++) - if (orgs.get(i).getId() == targetOrgId) { - actionBar.setSelectedNavigationItem(i); - break; - } - } - - @Override - public void onLoaderReset(Loader> listLoader) { - } - - @Override - public User addListener(OrganizationSelectionListener listener) { - if (listener != null) - orgSelectionListeners.add(listener); - return org; - } - - @Override - public OrganizationSelectionProvider removeListener( - OrganizationSelectionListener listener) { - if (listener != null) - orgSelectionListeners.remove(listener); - return this; - } - - @Override - protected HomePagerAdapter createAdapter() { - return new HomePagerAdapter(this, isDefaultUser); - } - - @Override - protected String getIcon(int position) { - switch (position) { - case 0: - return ICON_NEWS; - case 1: - return ICON_PUBLIC; - case 2: - return isDefaultUser ? ICON_WATCH : ICON_TEAM; - case 3: - return ICON_FOLLOW; - default: - return super.getIcon(position); - } - } -} From fe89283343094682b03c719a99731b566e48c2eb Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Tue, 13 Jan 2015 21:23:40 +0700 Subject: [PATCH 0414/1055] Add general dimens For devices that don't know where to go to get their dp size for navigation drawer. --- app/res/values/dimens.xml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 app/res/values/dimens.xml diff --git a/app/res/values/dimens.xml b/app/res/values/dimens.xml new file mode 100644 index 000000000..a3d1d52a1 --- /dev/null +++ b/app/res/values/dimens.xml @@ -0,0 +1,4 @@ + + + 304dp + \ No newline at end of file From 0557d92b14fd3fe285177b84f59b5c47372d0b03 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Tue, 13 Jan 2015 21:25:09 +0700 Subject: [PATCH 0415/1055] Update dp to follow material guideline http://www.google.com/design/spec/patterns/navigation-drawer.html --- app/res/layout/fragment_navigation_drawer.xml | 3 ++- app/res/values-sw384dp/dimens.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/res/layout/fragment_navigation_drawer.xml b/app/res/layout/fragment_navigation_drawer.xml index bd014bbb5..9f664f0e7 100644 --- a/app/res/layout/fragment_navigation_drawer.xml +++ b/app/res/layout/fragment_navigation_drawer.xml @@ -7,7 +7,7 @@ - 320dp + 328dp \ No newline at end of file From 3ee24b2b5ed786f58cb66b71e6c8e03865d246ee Mon Sep 17 00:00:00 2001 From: Henrik Date: Tue, 13 Jan 2015 20:55:53 +0100 Subject: [PATCH 0416/1055] Fixed commit view layout (#672) --- app/res/layout/commit_list.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/res/layout/commit_list.xml b/app/res/layout/commit_list.xml index a19c1e996..74895a89a 100644 --- a/app/res/layout/commit_list.xml +++ b/app/res/layout/commit_list.xml @@ -38,6 +38,7 @@ @@ -46,7 +47,6 @@ style="@style/ListView" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_above="@id/rl_branch" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:visibility="gone" /> From 0df31210725008a63384b106aabb2c4899c32224 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Tue, 13 Jan 2015 21:23:40 +0700 Subject: [PATCH 0417/1055] Add general dimens For devices that don't know where to go to get their dp size for navigation drawer. --- app/res/values/dimens.xml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 app/res/values/dimens.xml diff --git a/app/res/values/dimens.xml b/app/res/values/dimens.xml new file mode 100644 index 000000000..a3d1d52a1 --- /dev/null +++ b/app/res/values/dimens.xml @@ -0,0 +1,4 @@ + + + 304dp + \ No newline at end of file From 4db611711ab5a67e68710e8011e776ae340cb2fd Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Tue, 13 Jan 2015 21:25:09 +0700 Subject: [PATCH 0418/1055] Update dp to follow material guideline http://www.google.com/design/spec/patterns/navigation-drawer.html --- app/res/layout/fragment_navigation_drawer.xml | 3 ++- app/res/values-sw384dp/dimens.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/res/layout/fragment_navigation_drawer.xml b/app/res/layout/fragment_navigation_drawer.xml index bd014bbb5..9f664f0e7 100644 --- a/app/res/layout/fragment_navigation_drawer.xml +++ b/app/res/layout/fragment_navigation_drawer.xml @@ -7,7 +7,7 @@ - 320dp + 328dp \ No newline at end of file From d17e45c6bac7f6948452c0910cf1899b9fe266ff Mon Sep 17 00:00:00 2001 From: Henrik Date: Tue, 13 Jan 2015 20:55:53 +0100 Subject: [PATCH 0419/1055] Fixed commit view layout (#672) --- app/res/layout/commit_list.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/res/layout/commit_list.xml b/app/res/layout/commit_list.xml index a19c1e996..74895a89a 100644 --- a/app/res/layout/commit_list.xml +++ b/app/res/layout/commit_list.xml @@ -38,6 +38,7 @@ @@ -46,7 +47,6 @@ style="@style/ListView" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_above="@id/rl_branch" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:visibility="gone" /> From 5e4339eb0e60de9d737eb810e7bec59087711a54 Mon Sep 17 00:00:00 2001 From: Henrik Date: Tue, 13 Jan 2015 21:11:06 +0100 Subject: [PATCH 0420/1055] Fix #673 Cannot rescale files Add during code view --- app/res/layout/commit_file_view.xml | 3 ++- .../java/com/github/mobile/ui/ref/BranchFileViewActivity.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/res/layout/commit_file_view.xml b/app/res/layout/commit_file_view.xml index b44c70aec..ba094ac67 100644 --- a/app/res/layout/commit_file_view.xml +++ b/app/res/layout/commit_file_view.xml @@ -23,13 +23,14 @@ android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="?attr/colorPrimary" + android:layout_alignParentTop="true" android:id="@+id/toolbar" /> Date: Thu, 15 Jan 2015 00:15:59 -0800 Subject: [PATCH 0421/1055] Set correct toolbar themes for proper ripple and icon colors, extract to style --- app/res/layout/activity_main.xml | 2 ++ app/res/layout/commit_compare.xml | 2 ++ app/res/layout/commit_file_view.xml | 2 ++ app/res/layout/gist_create.xml | 2 ++ app/res/layout/issue_edit.xml | 2 ++ app/res/layout/issue_search.xml | 2 ++ app/res/layout/issues_filter_edit.xml | 2 ++ app/res/layout/issues_filter_list.xml | 2 ++ app/res/layout/login.xml | 2 ++ app/res/layout/login_two_factor_auth.xml | 2 ++ app/res/layout/pager.xml | 2 ++ app/res/layout/pager_with_tabs.xml | 2 ++ app/res/layout/pager_with_title.xml | 1 + app/res/layout/repo_contributors.xml | 2 ++ app/res/layout/repo_issue_list.xml | 2 ++ app/res/values/theme.xml | 7 +++++-- 16 files changed, 34 insertions(+), 2 deletions(-) diff --git a/app/res/layout/activity_main.xml b/app/res/layout/activity_main.xml index 8735ba354..cf179bdfd 100644 --- a/app/res/layout/activity_main.xml +++ b/app/res/layout/activity_main.xml @@ -1,5 +1,6 @@ diff --git a/app/res/layout/commit_compare.xml b/app/res/layout/commit_compare.xml index 9c03c9294..9f4c47f78 100644 --- a/app/res/layout/commit_compare.xml +++ b/app/res/layout/commit_compare.xml @@ -14,12 +14,14 @@ limitations under the License. --> diff --git a/app/res/layout/commit_file_view.xml b/app/res/layout/commit_file_view.xml index ba094ac67..dbabb591c 100644 --- a/app/res/layout/commit_file_view.xml +++ b/app/res/layout/commit_file_view.xml @@ -15,12 +15,14 @@ --> diff --git a/app/res/layout/issue_search.xml b/app/res/layout/issue_search.xml index 3ff70e2dc..a2b1d8c58 100644 --- a/app/res/layout/issue_search.xml +++ b/app/res/layout/issue_search.xml @@ -14,12 +14,14 @@ limitations under the License. --> @@ -21,6 +22,7 @@ diff --git a/app/res/layout/login_two_factor_auth.xml b/app/res/layout/login_two_factor_auth.xml index 75389d690..7e7ba26eb 100644 --- a/app/res/layout/login_two_factor_auth.xml +++ b/app/res/layout/login_two_factor_auth.xml @@ -14,6 +14,7 @@ limitations under the License. --> @@ -21,6 +22,7 @@ diff --git a/app/res/layout/pager.xml b/app/res/layout/pager.xml index 450ef43e1..30942aed7 100644 --- a/app/res/layout/pager.xml +++ b/app/res/layout/pager.xml @@ -14,6 +14,7 @@ limitations under the License. --> @@ -21,6 +22,7 @@ diff --git a/app/res/layout/pager_with_tabs.xml b/app/res/layout/pager_with_tabs.xml index fb8880a5d..fbe5935b5 100644 --- a/app/res/layout/pager_with_tabs.xml +++ b/app/res/layout/pager_with_tabs.xml @@ -14,6 +14,7 @@ limitations under the License. --> @@ -21,6 +22,7 @@ diff --git a/app/res/layout/repo_contributors.xml b/app/res/layout/repo_contributors.xml index b2009a724..9381f2412 100644 --- a/app/res/layout/repo_contributors.xml +++ b/app/res/layout/repo_contributors.xml @@ -14,12 +14,14 @@ limitations under the License. --> @color/primary_dark @color/accent - @color/ripple_material_light - @style/ThemeOverlay.AppCompat.Dark @style/Widget.Styled.ActionBar @@ -43,4 +41,9 @@ 16dp + + \ No newline at end of file From 0b8c1c6b2e9a90ed3e5e7de50323358786116d3a Mon Sep 17 00:00:00 2001 From: Henrik Date: Thu, 15 Jan 2015 20:40:35 +0100 Subject: [PATCH 0422/1055] Fixed Toolbar for Commit compare, Issue edit and Gist file view --- app/res/layout/commit_compare.xml | 1 + app/res/layout/issue_edit.xml | 3 ++- app/res/layout/pager_with_title.xml | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/res/layout/commit_compare.xml b/app/res/layout/commit_compare.xml index 9c03c9294..f3f02377d 100644 --- a/app/res/layout/commit_compare.xml +++ b/app/res/layout/commit_compare.xml @@ -26,6 +26,7 @@ diff --git a/app/res/layout/issue_edit.xml b/app/res/layout/issue_edit.xml index 95faecf19..ebc81435e 100644 --- a/app/res/layout/issue_edit.xml +++ b/app/res/layout/issue_edit.xml @@ -22,6 +22,7 @@ android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="?attr/colorPrimary" + android:layout_alignParentTop="true" android:id="@+id/toolbar" /> - + \ No newline at end of file From a6ae2f42bdce4825f2992d5ec1089008e90d5efa Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Thu, 15 Jan 2015 20:50:52 -0800 Subject: [PATCH 0423/1055] Improve navdrawer UI This does a few things: * Runs the nav drawer underneath the statusbar in lollipop+ devices to match the material spec * Enlarges the text and avatar in the header * Add real name text field and show if it's available * Extend height of header to more naturally wrap the content within it * Later, if more granular profile controls are added, these would be controlled from here. --- app/AndroidManifest.xml | 1 + app/res/layout/activity_main.xml | 1 + app/res/layout/fragment_navigation_drawer.xml | 57 ++++++++++++------- app/res/values-v21/dimens.xml | 5 ++ app/res/values-v21/themes.xml | 21 +++++++ app/res/values/dimens.xml | 2 + app/res/values/theme.xml | 2 + .../mobile/ui/NavigationDrawerFragment.java | 9 +++ 8 files changed, 78 insertions(+), 20 deletions(-) create mode 100644 app/res/values-v21/dimens.xml create mode 100644 app/res/values-v21/themes.xml diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index b395426c9..a1931735e 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -26,6 +26,7 @@ android:theme="@style/Theme.GitHub"> diff --git a/app/res/layout/activity_main.xml b/app/res/layout/activity_main.xml index cf179bdfd..99b89635c 100644 --- a/app/res/layout/activity_main.xml +++ b/app/res/layout/activity_main.xml @@ -14,6 +14,7 @@ - - - - - - + android:paddingTop="@dimen/toolbar_top_padding" + android:layout_margin="16dp" + android:orientation="vertical" + android:layout_gravity="bottom" + > + + + + + + + + + + + + 24dp + 178dp + \ No newline at end of file diff --git a/app/res/values-v21/themes.xml b/app/res/values-v21/themes.xml new file mode 100644 index 000000000..5306ab420 --- /dev/null +++ b/app/res/values-v21/themes.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/app/res/values/dimens.xml b/app/res/values/dimens.xml index a3d1d52a1..90b5fb3b1 100644 --- a/app/res/values/dimens.xml +++ b/app/res/values/dimens.xml @@ -1,4 +1,6 @@ 304dp + 0dp + 152dp \ No newline at end of file diff --git a/app/res/values/theme.xml b/app/res/values/theme.xml index e9ad511ec..9d697d454 100644 --- a/app/res/values/theme.xml +++ b/app/res/values/theme.xml @@ -29,6 +29,8 @@ @color/background + \ No newline at end of file diff --git a/app/res/values/theme.xml b/app/res/values/theme.xml index 9d697d454..79905040c 100644 --- a/app/res/values/theme.xml +++ b/app/res/values/theme.xml @@ -29,7 +29,9 @@ @color/background - From 8e9b10df5e04c0d55b72b414b9540da01b209cb4 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Fri, 3 Apr 2015 19:43:20 +0200 Subject: [PATCH 0491/1055] adding a missing default translation --- app/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml index c9e66c401..afb0b9dbf 100644 --- a/app/res/values/strings.xml +++ b/app/res/values/strings.xml @@ -300,6 +300,6 @@ This will permanently delete the repository, wiki, issues, and comments, and remove all collaborator associations. Repository is deleted - + Login or Email From 1a423fe7c8cebf3979ffa057ceb23254779d1378 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Tue, 21 Apr 2015 22:33:31 +0200 Subject: [PATCH 0492/1055] Fixing lint error "SuspiciousImport: 'import android.R' statement" ../../src/main/java/com/github/mobile/ui/SlidingTabStrip.java:19: Don't include android.R here; use a fully qualified name for each usage instead Priority: 9 / 10 Category: Correctness Severity: Warning Explanation: 'import android.R' statement. Importing android.R is usually not intentional; it sometimes happens when you use an IDE and ask it to automatically add imports at a time when your project's R class it not present. Once the import is there you might get a lot of "confusing" error messages because of course the fields available on android.R are not the ones you'd expect from just looking at your own R class. --- app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java b/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java index 6bae00f4d..ed1aeac18 100644 --- a/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java +++ b/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java @@ -16,7 +16,6 @@ package com.github.mobile.ui; -import android.R; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; @@ -65,7 +64,7 @@ class SlidingTabStrip extends LinearLayout { final float density = getResources().getDisplayMetrics().density; TypedValue outValue = new TypedValue(); - context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true); + context.getTheme().resolveAttribute(android.R.attr.colorForeground, outValue, true); final int themeForegroundColor = outValue.data; mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor, From 08035b2d17042cdabcc2dacce489ceae8667640e Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Wed, 22 Apr 2015 00:45:27 +0200 Subject: [PATCH 0493/1055] diamond interface --- app/src/main/java/com/github/mobile/GitHubModule.java | 6 +++--- .../java/com/github/mobile/accounts/AccountScope.java | 6 +++--- .../java/com/github/mobile/accounts/AccountUtils.java | 2 +- app/src/main/java/com/github/mobile/core/ItemStore.java | 6 +++--- .../main/java/com/github/mobile/core/ResourcePager.java | 4 ++-- .../main/java/com/github/mobile/core/code/FullTree.java | 4 ++-- .../java/com/github/mobile/core/commit/CommitStore.java | 4 ++-- .../java/com/github/mobile/core/commit/FullCommit.java | 4 ++-- .../com/github/mobile/core/commit/FullCommitFile.java | 4 ++-- .../main/java/com/github/mobile/core/gist/GistStore.java | 4 ++-- .../java/com/github/mobile/core/issue/IssueFilter.java | 8 ++++---- .../java/com/github/mobile/core/issue/IssueStore.java | 4 ++-- .../com/github/mobile/core/search/SearchUserService.java | 2 +- app/src/main/java/com/github/mobile/model/App.java | 2 +- .../main/java/com/github/mobile/model/Authorization.java | 4 ++-- .../com/github/mobile/persistence/AccountDataManager.java | 2 +- .../java/com/github/mobile/persistence/DatabaseCache.java | 2 +- .../mobile/persistence/OrganizationRepositories.java | 4 ++-- .../java/com/github/mobile/persistence/Organizations.java | 2 +- .../main/java/com/github/mobile/ui/ItemListFragment.java | 2 +- .../com/github/mobile/ui/code/RepositoryCodeFragment.java | 4 ++-- .../mobile/ui/commit/CommitCompareListFragment.java | 2 +- .../github/mobile/ui/commit/CommitDiffListFragment.java | 2 +- .../main/java/com/github/mobile/ui/commit/DiffStyler.java | 4 ++-- .../main/java/com/github/mobile/ui/gist/GistFragment.java | 4 ++-- .../java/com/github/mobile/ui/gist/GistsPagerAdapter.java | 2 +- .../java/com/github/mobile/ui/issue/AssigneeDialog.java | 4 ++-- .../com/github/mobile/ui/issue/FilterListFragment.java | 2 +- .../com/github/mobile/ui/issue/IssuesPagerAdapter.java | 2 +- .../java/com/github/mobile/ui/issue/LabelsDialog.java | 6 +++--- .../com/github/mobile/ui/issue/LabelsDialogFragment.java | 4 ++-- .../java/com/github/mobile/ui/issue/MilestoneDialog.java | 2 +- .../github/mobile/ui/issue/SearchIssueListFragment.java | 2 +- app/src/main/java/com/github/mobile/ui/ref/RefDialog.java | 4 ++-- .../mobile/ui/repo/DefaultRepositoryListAdapter.java | 4 ++-- .../com/github/mobile/ui/repo/RecentRepositories.java | 2 +- .../main/java/com/github/mobile/util/AvatarLoader.java | 2 +- app/src/main/java/com/github/mobile/util/HtmlUtils.java | 2 +- .../main/java/com/github/mobile/util/HttpImageGetter.java | 4 ++-- 39 files changed, 67 insertions(+), 67 deletions(-) diff --git a/app/src/main/java/com/github/mobile/GitHubModule.java b/app/src/main/java/com/github/mobile/GitHubModule.java index 65277f6ad..f6a23aa9d 100644 --- a/app/src/main/java/com/github/mobile/GitHubModule.java +++ b/app/src/main/java/com/github/mobile/GitHubModule.java @@ -77,7 +77,7 @@ IssueStore issueStore(IssueService issueService, IssueStore store = issues != null ? issues.get() : null; if (store == null) { store = new IssueStore(issueService, pullService); - issues = new WeakReference(store); + issues = new WeakReference<>(store); } return store; } @@ -87,7 +87,7 @@ GistStore gistStore(GistService service) { GistStore store = gists != null ? gists.get() : null; if (store == null) { store = new GistStore(service); - gists = new WeakReference(store); + gists = new WeakReference<>(store); } return store; } @@ -97,7 +97,7 @@ CommitStore commitStore(CommitService service) { CommitStore store = commits != null ? commits.get() : null; if (store == null) { store = new CommitStore(service); - commits = new WeakReference(store); + commits = new WeakReference<>(store); } return store; } diff --git a/app/src/main/java/com/github/mobile/accounts/AccountScope.java b/app/src/main/java/com/github/mobile/accounts/AccountScope.java index 2c96b65d7..1c52aca97 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountScope.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountScope.java @@ -54,9 +54,9 @@ AccountScope. seededKeyProvider()).in( }; } - private final ThreadLocal currentAccount = new ThreadLocal(); + private final ThreadLocal currentAccount = new ThreadLocal<>(); - private final Map, Object>> repoScopeMaps = new ConcurrentHashMap, Object>>(); + private final Map, Object>> repoScopeMaps = new ConcurrentHashMap<>(); /** * Enters scope using a GitHubAccount derived from the supplied account @@ -101,7 +101,7 @@ protected Map, Object> getScopedObjectMap(final Key key) { Map, Object> scopeMap = repoScopeMaps.get(account); if (scopeMap == null) { - scopeMap = new ConcurrentHashMap, Object>(); + scopeMap = new ConcurrentHashMap<>(); scopeMap.put(GITHUB_ACCOUNT_KEY, account); repoScopeMaps.put(account, scopeMap); } diff --git a/app/src/main/java/com/github/mobile/accounts/AccountUtils.java b/app/src/main/java/com/github/mobile/accounts/AccountUtils.java index b8c630914..3c627e783 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountUtils.java +++ b/app/src/main/java/com/github/mobile/accounts/AccountUtils.java @@ -167,7 +167,7 @@ public static Account getPasswordAccessibleAccount(final Context context) { private static Account[] getPasswordAccessibleAccounts( final AccountManager manager, final Account[] candidates) throws AuthenticatorConflictException { - final List accessible = new ArrayList( + final List accessible = new ArrayList<>( candidates.length); boolean exceptionThrown = false; for (Account account : candidates) diff --git a/app/src/main/java/com/github/mobile/core/ItemStore.java b/app/src/main/java/com/github/mobile/core/ItemStore.java index 99de832d3..74139d6d0 100644 --- a/app/src/main/java/com/github/mobile/core/ItemStore.java +++ b/app/src/main/java/com/github/mobile/core/ItemStore.java @@ -57,8 +57,8 @@ protected static class ItemReferences { * Create reference store */ public ItemReferences() { - queue = new ReferenceQueue(); - items = new ConcurrentHashMap>(); + queue = new ReferenceQueue<>(); + items = new ConcurrentHashMap<>(); } @SuppressWarnings("rawtypes") @@ -88,7 +88,7 @@ public V get(final Object id) { */ public void put(Object id, V item) { expungeEntries(); - items.put(id, new ItemReference(item, id, queue)); + items.put(id, new ItemReference<>(item, id, queue)); } } } diff --git a/app/src/main/java/com/github/mobile/core/ResourcePager.java b/app/src/main/java/com/github/mobile/core/ResourcePager.java index 28b29e195..8ae0866a6 100644 --- a/app/src/main/java/com/github/mobile/core/ResourcePager.java +++ b/app/src/main/java/com/github/mobile/core/ResourcePager.java @@ -45,7 +45,7 @@ public abstract class ResourcePager { /** * All resources retrieved */ - protected final Map resources = new LinkedHashMap(); + protected final Map resources = new LinkedHashMap<>(); /** * Are more pages available? @@ -92,7 +92,7 @@ public int size() { * @return resources */ public List getResources() { - return new ArrayList(resources.values()); + return new ArrayList<>(resources.values()); } /** diff --git a/app/src/main/java/com/github/mobile/core/code/FullTree.java b/app/src/main/java/com/github/mobile/core/code/FullTree.java index bd5f32ae7..f8bc7d934 100644 --- a/app/src/main/java/com/github/mobile/core/code/FullTree.java +++ b/app/src/main/java/com/github/mobile/core/code/FullTree.java @@ -82,13 +82,13 @@ public static class Folder extends Entry { /** * Sub folders */ - public final Map folders = new TreeMap( + public final Map folders = new TreeMap<>( CASE_INSENSITIVE_ORDER); /** * Files */ - public final Map files = new TreeMap( + public final Map files = new TreeMap<>( CASE_INSENSITIVE_ORDER); private Folder() { diff --git a/app/src/main/java/com/github/mobile/core/commit/CommitStore.java b/app/src/main/java/com/github/mobile/core/commit/CommitStore.java index 35372db29..689796085 100644 --- a/app/src/main/java/com/github/mobile/core/commit/CommitStore.java +++ b/app/src/main/java/com/github/mobile/core/commit/CommitStore.java @@ -30,7 +30,7 @@ */ public class CommitStore extends ItemStore { - private final Map> commits = new HashMap>(); + private final Map> commits = new HashMap<>(); private final CommitService service; @@ -81,7 +81,7 @@ public RepositoryCommit addCommit(IRepositoryIdProvider repo, String repoId = repo.generateId(); ItemReferences repoCommits = commits.get(repoId); if (repoCommits == null) { - repoCommits = new ItemReferences(); + repoCommits = new ItemReferences<>(); commits.put(repoId, repoCommits); } repoCommits.put(commit.getSha(), commit); diff --git a/app/src/main/java/com/github/mobile/core/commit/FullCommit.java b/app/src/main/java/com/github/mobile/core/commit/FullCommit.java index 070cf3a68..2a0b4e305 100644 --- a/app/src/main/java/com/github/mobile/core/commit/FullCommit.java +++ b/app/src/main/java/com/github/mobile/core/commit/FullCommit.java @@ -49,7 +49,7 @@ public FullCommit(final RepositoryCommit commit) { this.commit = commit; List rawFiles = commit.getFiles(); if (rawFiles != null && !rawFiles.isEmpty()) { - files = new ArrayList(rawFiles.size()); + files = new ArrayList<>(rawFiles.size()); for (CommitFile file : rawFiles) files.add(new FullCommitFile(file)); } else @@ -70,7 +70,7 @@ public FullCommit(final RepositoryCommit commit, boolean hasComments = comments != null && !comments.isEmpty(); boolean hasFiles = rawFiles != null && !rawFiles.isEmpty(); if (hasFiles) { - files = new ArrayList(rawFiles.size()); + files = new ArrayList<>(rawFiles.size()); if (hasComments) { for (CommitFile file : rawFiles) { Iterator iterator = comments.iterator(); diff --git a/app/src/main/java/com/github/mobile/core/commit/FullCommitFile.java b/app/src/main/java/com/github/mobile/core/commit/FullCommitFile.java index bfa2ceb38..ec0db2bb4 100644 --- a/app/src/main/java/com/github/mobile/core/commit/FullCommitFile.java +++ b/app/src/main/java/com/github/mobile/core/commit/FullCommitFile.java @@ -29,7 +29,7 @@ */ public class FullCommitFile { - private final SparseArray> comments = new SparseArray>( + private final SparseArray> comments = new SparseArray<>( 4); private final CommitFile file; @@ -66,7 +66,7 @@ public FullCommitFile add(final CommitComment comment) { if (line >= 0) { List lineComments = comments.get(line); if (lineComments == null) { - lineComments = new ArrayList(4); + lineComments = new ArrayList<>(4); comments.put(line, lineComments); } lineComments.add(comment); diff --git a/app/src/main/java/com/github/mobile/core/gist/GistStore.java b/app/src/main/java/com/github/mobile/core/gist/GistStore.java index ecf5cbbc0..11469f1e3 100644 --- a/app/src/main/java/com/github/mobile/core/gist/GistStore.java +++ b/app/src/main/java/com/github/mobile/core/gist/GistStore.java @@ -32,7 +32,7 @@ */ public class GistStore extends ItemStore { - private final ItemReferences gists = new ItemReferences(); + private final ItemReferences gists = new ItemReferences<>(); private final GistService service; @@ -66,7 +66,7 @@ protected Map sortFiles(final Gist gist) { if (files == null || files.size() < 2) return files; - Map sorted = new TreeMap( + Map sorted = new TreeMap<>( CASE_INSENSITIVE_ORDER); sorted.putAll(files); return sorted; diff --git a/app/src/main/java/com/github/mobile/core/issue/IssueFilter.java b/app/src/main/java/com/github/mobile/core/issue/IssueFilter.java index ce6f0136c..4eabbe6a2 100644 --- a/app/src/main/java/com/github/mobile/core/issue/IssueFilter.java +++ b/app/src/main/java/com/github/mobile/core/issue/IssueFilter.java @@ -93,7 +93,7 @@ public IssueFilter addLabel(Label label) { if (label == null) return this; if (labels == null) - labels = new TreeSet

- * To use the component, simply add it to your view hierarchy. Then in your - * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call - * {@link #setViewPager(android.support.v4.view.ViewPager)} providing it the ViewPager this layout is being used for. - *

- * The colors can be customized in two ways. The first and simplest is to provide an array of colors - * via {@link #setSelectedIndicatorColors(int...)} and {@link #setDividerColors(int...)}. The - * alternative is via the {@link com.github.mobile.ui.SlidingTabLayout.TabColorizer} interface which provides you complete control over - * which color is used for any individual position. - *

- * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)}, - * providing the layout ID of your custom layout. - */ -public class SlidingTabLayout extends HorizontalScrollView { - - /** - * Allows complete control over the colors drawn in the tab layout. Set with - * {@link #setCustomTabColorizer(com.github.mobile.ui.SlidingTabLayout.TabColorizer)}. - */ - public interface TabColorizer { - - /** - * @return return the color of the indicator used when {@code position} is selected. - */ - int getIndicatorColor(int position); - - /** - * @return return the color of the divider drawn to the right of {@code position}. - */ - int getDividerColor(int position); - - } - - private static final int TITLE_OFFSET_DIPS = 24; - private static final int TAB_VIEW_PADDING_DIPS = 16; - private static final int TAB_VIEW_TEXT_SIZE_SP = 12; - - private int mTitleOffset; - - private int mTabViewLayoutId; - private int mTabViewTextViewId; - - private ViewPager mViewPager; - private ViewPager.OnPageChangeListener mViewPagerPageChangeListener; - - private final SlidingTabStrip mTabStrip; - - public SlidingTabLayout(Context context) { - this(context, null); - } - - public SlidingTabLayout(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - // Disable the Scroll Bar - setHorizontalScrollBarEnabled(false); - // Make sure that the Tab Strips fills this View - setFillViewport(true); - - mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density); - - mTabStrip = new SlidingTabStrip(context); - addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - } - - /** - * Set the custom {@link com.github.mobile.ui.SlidingTabLayout.TabColorizer} to be used. - *

- * If you only require simple custmisation then you can use - * {@link #setSelectedIndicatorColors(int...)} and {@link #setDividerColors(int...)} to achieve - * similar effects. - */ - public void setCustomTabColorizer(TabColorizer tabColorizer) { - mTabStrip.setCustomTabColorizer(tabColorizer); - } - - /** - * Sets the colors to be used for indicating the selected tab. These colors are treated as a - * circular array. Providing one color will mean that all tabs are indicated with the same color. - */ - public void setSelectedIndicatorColors(int... colors) { - mTabStrip.setSelectedIndicatorColors(colors); - } - - /** - * Sets the colors to be used for tab dividers. These colors are treated as a circular array. - * Providing one color will mean that all tabs are indicated with the same color. - */ - public void setDividerColors(int... colors) { - mTabStrip.setDividerColors(colors); - } - - /** - * Set the {@link android.support.v4.view.ViewPager.OnPageChangeListener}. When using {@link com.github.mobile.ui.SlidingTabLayout} you are - * required to set any {@link android.support.v4.view.ViewPager.OnPageChangeListener} through this method. This is so - * that the layout can update it's scroll position correctly. - * - * @see android.support.v4.view.ViewPager#setOnPageChangeListener(android.support.v4.view.ViewPager.OnPageChangeListener) - */ - public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) { - mViewPagerPageChangeListener = listener; - } - - /** - * Set the custom layout to be inflated for the tab views. - * - * @param layoutResId Layout id to be inflated - * @param textViewId id of the {@link android.widget.TextView} in the inflated view - */ - public void setCustomTabView(int layoutResId, int textViewId) { - mTabViewLayoutId = layoutResId; - mTabViewTextViewId = textViewId; - } - - /** - * Sets the associated view pager. Note that the assumption here is that the pager content - * (number of tabs and tab titles) does not change after this call has been made. - */ - public void setViewPager(ViewPager viewPager) { - mTabStrip.removeAllViews(); - - mViewPager = viewPager; - if (viewPager != null) { - viewPager.setOnPageChangeListener(new InternalViewPagerListener()); - populateTabStrip(); - } - } - - /** - * Create a default view to be used for tabs. This is called if a custom tab view is not set via - * {@link #setCustomTabView(int, int)}. - */ - protected TextView createDefaultTabView(Context context) { - TextView textView = new TextView(context); - textView.setGravity(Gravity.CENTER); - textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); - textView.setTypeface(Typeface.DEFAULT_BOLD); - - TypedValue outValue = new TypedValue(); - getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, - outValue, true); - textView.setBackgroundResource(outValue.resourceId); - textView.setAllCaps(true); - - int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); - textView.setPadding(padding, padding, padding, padding); - - return textView; - } - - private void populateTabStrip() { - final PagerAdapter adapter = mViewPager.getAdapter(); - final OnClickListener tabClickListener = new TabClickListener(); - - for (int i = 0; i < adapter.getCount(); i++) { - View tabView = null; - TextView tabTitleView = null; - - if (mTabViewLayoutId != 0) { - // If there is a custom tab view layout id set, try and inflate it - tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, - false); - tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); - } - - if (tabView == null) { - tabView = createDefaultTabView(getContext()); - } - - if (tabTitleView == null && TextView.class.isInstance(tabView)) { - tabTitleView = (TextView) tabView; - } - - tabTitleView.setText(adapter.getPageTitle(i)); - tabView.setOnClickListener(tabClickListener); - - mTabStrip.addView(tabView); - - if (i == mViewPager.getCurrentItem()) { - tabView.setSelected(true); - } - } - - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - - if (mViewPager != null) { - scrollToTab(mViewPager.getCurrentItem(), 0); - } - } - - private void scrollToTab(int tabIndex, int positionOffset) { - final int tabStripChildCount = mTabStrip.getChildCount(); - if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { - return; - } - - View selectedChild = mTabStrip.getChildAt(tabIndex); - if (selectedChild != null) { - int targetScrollX = selectedChild.getLeft() + positionOffset; - - if (tabIndex > 0 || positionOffset > 0) { - // If we're not at the first child and are mid-scroll, make sure we obey the offset - targetScrollX -= mTitleOffset; - } - - scrollTo(targetScrollX, 0); - } - } - - private class InternalViewPagerListener implements ViewPager.OnPageChangeListener { - private int mScrollState; - - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - int tabStripChildCount = mTabStrip.getChildCount(); - if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) { - return; - } - - mTabStrip.onViewPagerPageChanged(position, positionOffset); - - View selectedTitle = mTabStrip.getChildAt(position); - int extraOffset = (selectedTitle != null) - ? (int) (positionOffset * selectedTitle.getWidth()) - : 0; - scrollToTab(position, extraOffset); - - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageScrolled(position, positionOffset, - positionOffsetPixels); - } - } - - @Override - public void onPageScrollStateChanged(int state) { - mScrollState = state; - - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageScrollStateChanged(state); - } - } - - @Override - public void onPageSelected(int position) { - if (mScrollState == ViewPager.SCROLL_STATE_IDLE) { - mTabStrip.onViewPagerPageChanged(position, 0f); - scrollToTab(position, 0); - } - for (int i = 0; i < mTabStrip.getChildCount(); i++) { - mTabStrip.getChildAt(i).setSelected(position == i); - } - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageSelected(position); - } - } - - } - - private class TabClickListener implements OnClickListener { - @Override - public void onClick(View v) { - for (int i = 0; i < mTabStrip.getChildCount(); i++) { - if (v == mTabStrip.getChildAt(i)) { - mViewPager.setCurrentItem(i); - return; - } - } - } - } - -} diff --git a/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java b/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java deleted file mode 100644 index ed1aeac18..000000000 --- a/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.mobile.ui; - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.util.AttributeSet; -import android.util.TypedValue; -import android.view.View; -import android.widget.LinearLayout; - -class SlidingTabStrip extends LinearLayout { - - private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 0; - private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26; - private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 6; - private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5; - - private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1; - private static final byte DEFAULT_DIVIDER_COLOR_ALPHA = 0x20; - private static final float DEFAULT_DIVIDER_HEIGHT = 0.5f; - - private final int mBottomBorderThickness; - private final Paint mBottomBorderPaint; - - private final int mSelectedIndicatorThickness; - private final Paint mSelectedIndicatorPaint; - - private final int mDefaultBottomBorderColor; - - private final Paint mDividerPaint; - private final float mDividerHeight; - - private int mSelectedPosition; - private float mSelectionOffset; - - private SlidingTabLayout.TabColorizer mCustomTabColorizer; - private final SimpleTabColorizer mDefaultTabColorizer; - - SlidingTabStrip(Context context) { - this(context, null); - } - - SlidingTabStrip(Context context, AttributeSet attrs) { - super(context, attrs); - setWillNotDraw(false); - - final float density = getResources().getDisplayMetrics().density; - - TypedValue outValue = new TypedValue(); - context.getTheme().resolveAttribute(android.R.attr.colorForeground, outValue, true); - final int themeForegroundColor = outValue.data; - - mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor, - DEFAULT_BOTTOM_BORDER_COLOR_ALPHA); - - mDefaultTabColorizer = new SimpleTabColorizer(); - mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR); - mDefaultTabColorizer.setDividerColors(setColorAlpha(themeForegroundColor, - DEFAULT_DIVIDER_COLOR_ALPHA)); - - mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density); - mBottomBorderPaint = new Paint(); - mBottomBorderPaint.setColor(mDefaultBottomBorderColor); - - mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density); - mSelectedIndicatorPaint = new Paint(); - - mDividerHeight = DEFAULT_DIVIDER_HEIGHT; - mDividerPaint = new Paint(); - mDividerPaint.setStrokeWidth((int) (DEFAULT_DIVIDER_THICKNESS_DIPS * density)); - } - - void setCustomTabColorizer(SlidingTabLayout.TabColorizer customTabColorizer) { - mCustomTabColorizer = customTabColorizer; - invalidate(); - } - - void setSelectedIndicatorColors(int... colors) { - // Make sure that the custom colorizer is removed - mCustomTabColorizer = null; - mDefaultTabColorizer.setIndicatorColors(colors); - invalidate(); - } - - void setDividerColors(int... colors) { - // Make sure that the custom colorizer is removed - mCustomTabColorizer = null; - mDefaultTabColorizer.setDividerColors(colors); - invalidate(); - } - - void onViewPagerPageChanged(int position, float positionOffset) { - mSelectedPosition = position; - mSelectionOffset = positionOffset; - invalidate(); - } - - @Override - protected void onDraw(Canvas canvas) { - final int height = getHeight(); - final int childCount = getChildCount(); - final int dividerHeightPx = (int) (Math.min(Math.max(0f, mDividerHeight), 1f) * height); - final SlidingTabLayout.TabColorizer tabColorizer = mCustomTabColorizer != null - ? mCustomTabColorizer - : mDefaultTabColorizer; - - // Thick colored underline below the current selection - if (childCount > 0) { - View selectedTitle = getChildAt(mSelectedPosition); - int left = selectedTitle.getLeft(); - int right = selectedTitle.getRight(); - int color = tabColorizer.getIndicatorColor(mSelectedPosition); - - if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) { - int nextColor = tabColorizer.getIndicatorColor(mSelectedPosition + 1); - if (color != nextColor) { - color = blendColors(nextColor, color, mSelectionOffset); - } - - // Draw the selection partway between the tabs - View nextTitle = getChildAt(mSelectedPosition + 1); - left = (int) (mSelectionOffset * nextTitle.getLeft() + - (1.0f - mSelectionOffset) * left); - right = (int) (mSelectionOffset * nextTitle.getRight() + - (1.0f - mSelectionOffset) * right); - } - - mSelectedIndicatorPaint.setColor(color); - - canvas.drawRect(left, height - mSelectedIndicatorThickness, right, - height, mSelectedIndicatorPaint); - } - - // Thin underline along the entire bottom edge - canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint); - - // Vertical separators between the titles - int separatorTop = (height - dividerHeightPx) / 2; - for (int i = 0; i < childCount - 1; i++) { - View child = getChildAt(i); - mDividerPaint.setColor(tabColorizer.getDividerColor(i)); - canvas.drawLine(child.getRight(), separatorTop, child.getRight(), - separatorTop + dividerHeightPx, mDividerPaint); - } - } - - /** - * Set the alpha value of the {@code color} to be the given {@code alpha} value. - */ - private static int setColorAlpha(int color, byte alpha) { - return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); - } - - /** - * Blend {@code color1} and {@code color2} using the given ratio. - * - * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend, - * 0.0 will return {@code color2}. - */ - private static int blendColors(int color1, int color2, float ratio) { - final float inverseRation = 1f - ratio; - float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); - float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); - float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); - return Color.rgb((int) r, (int) g, (int) b); - } - - private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { - private int[] mIndicatorColors; - private int[] mDividerColors; - - @Override - public final int getIndicatorColor(int position) { - return mIndicatorColors[position % mIndicatorColors.length]; - } - - @Override - public final int getDividerColor(int position) { - return mDividerColors[position % mDividerColors.length]; - } - - void setIndicatorColors(int... colors) { - mIndicatorColors = colors; - } - - void setDividerColors(int... colors) { - mDividerColors = colors; - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index 9ca4624ec..8f7ae7321 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -16,6 +16,7 @@ package com.github.mobile.ui; import android.os.Bundle; +import android.support.design.widget.TabLayout; import android.support.v4.view.PagerAdapter; import android.view.View; import android.widget.TabHost.OnTabChangeListener; @@ -40,7 +41,7 @@ public abstract class TabPagerActivity extends PagerFragment implements OnTabChangeListener, TabContentFactory { @@ -25,7 +27,7 @@ public abstract class TabPagerFragment Date: Thu, 25 Jun 2015 17:21:58 +0800 Subject: [PATCH 0528/1055] use CoordinatorLayout and TabLayout from Appcompat's design library --- app/build.gradle | 2 + .../github/mobile/ui/SlidingTabLayout.java | 313 ------------------ .../com/github/mobile/ui/SlidingTabStrip.java | 207 ------------ .../github/mobile/ui/TabPagerActivity.java | 10 +- .../github/mobile/ui/TabPagerFragment.java | 15 +- .../ui/comment/CreateCommentActivity.java | 28 +- app/src/main/res/layout/pager_with_tabs.xml | 43 ++- 7 files changed, 50 insertions(+), 568 deletions(-) delete mode 100644 app/src/main/java/com/github/mobile/ui/SlidingTabLayout.java delete mode 100644 app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java diff --git a/app/build.gradle b/app/build.gradle index 26a0aa212..f3c9762f6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,4 +53,6 @@ dependencies { exclude group: 'commons-logging', module: 'commons-logging' exclude group: 'org.apache.httpcomponents', module: 'httpclient' } + + compile 'com.android.support:design:22.2.0' } diff --git a/app/src/main/java/com/github/mobile/ui/SlidingTabLayout.java b/app/src/main/java/com/github/mobile/ui/SlidingTabLayout.java deleted file mode 100644 index 903f15358..000000000 --- a/app/src/main/java/com/github/mobile/ui/SlidingTabLayout.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.mobile.ui; - -import android.content.Context; -import android.graphics.Typeface; -import android.os.Build; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; -import android.util.AttributeSet; -import android.util.TypedValue; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.HorizontalScrollView; -import android.widget.TextView; - -/** - * To be used with ViewPager to provide a tab indicator component which give constant feedback as to - * the user's scroll progress. - *

- * To use the component, simply add it to your view hierarchy. Then in your - * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call - * {@link #setViewPager(android.support.v4.view.ViewPager)} providing it the ViewPager this layout is being used for. - *

- * The colors can be customized in two ways. The first and simplest is to provide an array of colors - * via {@link #setSelectedIndicatorColors(int...)} and {@link #setDividerColors(int...)}. The - * alternative is via the {@link com.github.mobile.ui.SlidingTabLayout.TabColorizer} interface which provides you complete control over - * which color is used for any individual position. - *

- * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)}, - * providing the layout ID of your custom layout. - */ -public class SlidingTabLayout extends HorizontalScrollView { - - /** - * Allows complete control over the colors drawn in the tab layout. Set with - * {@link #setCustomTabColorizer(com.github.mobile.ui.SlidingTabLayout.TabColorizer)}. - */ - public interface TabColorizer { - - /** - * @return return the color of the indicator used when {@code position} is selected. - */ - int getIndicatorColor(int position); - - /** - * @return return the color of the divider drawn to the right of {@code position}. - */ - int getDividerColor(int position); - - } - - private static final int TITLE_OFFSET_DIPS = 24; - private static final int TAB_VIEW_PADDING_DIPS = 16; - private static final int TAB_VIEW_TEXT_SIZE_SP = 12; - - private int mTitleOffset; - - private int mTabViewLayoutId; - private int mTabViewTextViewId; - - private ViewPager mViewPager; - private ViewPager.OnPageChangeListener mViewPagerPageChangeListener; - - private final SlidingTabStrip mTabStrip; - - public SlidingTabLayout(Context context) { - this(context, null); - } - - public SlidingTabLayout(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - // Disable the Scroll Bar - setHorizontalScrollBarEnabled(false); - // Make sure that the Tab Strips fills this View - setFillViewport(true); - - mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density); - - mTabStrip = new SlidingTabStrip(context); - addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - } - - /** - * Set the custom {@link com.github.mobile.ui.SlidingTabLayout.TabColorizer} to be used. - *

- * If you only require simple custmisation then you can use - * {@link #setSelectedIndicatorColors(int...)} and {@link #setDividerColors(int...)} to achieve - * similar effects. - */ - public void setCustomTabColorizer(TabColorizer tabColorizer) { - mTabStrip.setCustomTabColorizer(tabColorizer); - } - - /** - * Sets the colors to be used for indicating the selected tab. These colors are treated as a - * circular array. Providing one color will mean that all tabs are indicated with the same color. - */ - public void setSelectedIndicatorColors(int... colors) { - mTabStrip.setSelectedIndicatorColors(colors); - } - - /** - * Sets the colors to be used for tab dividers. These colors are treated as a circular array. - * Providing one color will mean that all tabs are indicated with the same color. - */ - public void setDividerColors(int... colors) { - mTabStrip.setDividerColors(colors); - } - - /** - * Set the {@link android.support.v4.view.ViewPager.OnPageChangeListener}. When using {@link com.github.mobile.ui.SlidingTabLayout} you are - * required to set any {@link android.support.v4.view.ViewPager.OnPageChangeListener} through this method. This is so - * that the layout can update it's scroll position correctly. - * - * @see android.support.v4.view.ViewPager#setOnPageChangeListener(android.support.v4.view.ViewPager.OnPageChangeListener) - */ - public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) { - mViewPagerPageChangeListener = listener; - } - - /** - * Set the custom layout to be inflated for the tab views. - * - * @param layoutResId Layout id to be inflated - * @param textViewId id of the {@link android.widget.TextView} in the inflated view - */ - public void setCustomTabView(int layoutResId, int textViewId) { - mTabViewLayoutId = layoutResId; - mTabViewTextViewId = textViewId; - } - - /** - * Sets the associated view pager. Note that the assumption here is that the pager content - * (number of tabs and tab titles) does not change after this call has been made. - */ - public void setViewPager(ViewPager viewPager) { - mTabStrip.removeAllViews(); - - mViewPager = viewPager; - if (viewPager != null) { - viewPager.setOnPageChangeListener(new InternalViewPagerListener()); - populateTabStrip(); - } - } - - /** - * Create a default view to be used for tabs. This is called if a custom tab view is not set via - * {@link #setCustomTabView(int, int)}. - */ - protected TextView createDefaultTabView(Context context) { - TextView textView = new TextView(context); - textView.setGravity(Gravity.CENTER); - textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); - textView.setTypeface(Typeface.DEFAULT_BOLD); - - TypedValue outValue = new TypedValue(); - getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, - outValue, true); - textView.setBackgroundResource(outValue.resourceId); - textView.setAllCaps(true); - - int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); - textView.setPadding(padding, padding, padding, padding); - - return textView; - } - - private void populateTabStrip() { - final PagerAdapter adapter = mViewPager.getAdapter(); - final OnClickListener tabClickListener = new TabClickListener(); - - for (int i = 0; i < adapter.getCount(); i++) { - View tabView = null; - TextView tabTitleView = null; - - if (mTabViewLayoutId != 0) { - // If there is a custom tab view layout id set, try and inflate it - tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, - false); - tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); - } - - if (tabView == null) { - tabView = createDefaultTabView(getContext()); - } - - if (tabTitleView == null && TextView.class.isInstance(tabView)) { - tabTitleView = (TextView) tabView; - } - - tabTitleView.setText(adapter.getPageTitle(i)); - tabView.setOnClickListener(tabClickListener); - - mTabStrip.addView(tabView); - - if (i == mViewPager.getCurrentItem()) { - tabView.setSelected(true); - } - } - - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - - if (mViewPager != null) { - scrollToTab(mViewPager.getCurrentItem(), 0); - } - } - - private void scrollToTab(int tabIndex, int positionOffset) { - final int tabStripChildCount = mTabStrip.getChildCount(); - if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { - return; - } - - View selectedChild = mTabStrip.getChildAt(tabIndex); - if (selectedChild != null) { - int targetScrollX = selectedChild.getLeft() + positionOffset; - - if (tabIndex > 0 || positionOffset > 0) { - // If we're not at the first child and are mid-scroll, make sure we obey the offset - targetScrollX -= mTitleOffset; - } - - scrollTo(targetScrollX, 0); - } - } - - private class InternalViewPagerListener implements ViewPager.OnPageChangeListener { - private int mScrollState; - - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - int tabStripChildCount = mTabStrip.getChildCount(); - if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) { - return; - } - - mTabStrip.onViewPagerPageChanged(position, positionOffset); - - View selectedTitle = mTabStrip.getChildAt(position); - int extraOffset = (selectedTitle != null) - ? (int) (positionOffset * selectedTitle.getWidth()) - : 0; - scrollToTab(position, extraOffset); - - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageScrolled(position, positionOffset, - positionOffsetPixels); - } - } - - @Override - public void onPageScrollStateChanged(int state) { - mScrollState = state; - - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageScrollStateChanged(state); - } - } - - @Override - public void onPageSelected(int position) { - if (mScrollState == ViewPager.SCROLL_STATE_IDLE) { - mTabStrip.onViewPagerPageChanged(position, 0f); - scrollToTab(position, 0); - } - for (int i = 0; i < mTabStrip.getChildCount(); i++) { - mTabStrip.getChildAt(i).setSelected(position == i); - } - if (mViewPagerPageChangeListener != null) { - mViewPagerPageChangeListener.onPageSelected(position); - } - } - - } - - private class TabClickListener implements OnClickListener { - @Override - public void onClick(View v) { - for (int i = 0; i < mTabStrip.getChildCount(); i++) { - if (v == mTabStrip.getChildAt(i)) { - mViewPager.setCurrentItem(i); - return; - } - } - } - } - -} diff --git a/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java b/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java deleted file mode 100644 index ed1aeac18..000000000 --- a/app/src/main/java/com/github/mobile/ui/SlidingTabStrip.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.github.mobile.ui; - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.util.AttributeSet; -import android.util.TypedValue; -import android.view.View; -import android.widget.LinearLayout; - -class SlidingTabStrip extends LinearLayout { - - private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 0; - private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26; - private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 6; - private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5; - - private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1; - private static final byte DEFAULT_DIVIDER_COLOR_ALPHA = 0x20; - private static final float DEFAULT_DIVIDER_HEIGHT = 0.5f; - - private final int mBottomBorderThickness; - private final Paint mBottomBorderPaint; - - private final int mSelectedIndicatorThickness; - private final Paint mSelectedIndicatorPaint; - - private final int mDefaultBottomBorderColor; - - private final Paint mDividerPaint; - private final float mDividerHeight; - - private int mSelectedPosition; - private float mSelectionOffset; - - private SlidingTabLayout.TabColorizer mCustomTabColorizer; - private final SimpleTabColorizer mDefaultTabColorizer; - - SlidingTabStrip(Context context) { - this(context, null); - } - - SlidingTabStrip(Context context, AttributeSet attrs) { - super(context, attrs); - setWillNotDraw(false); - - final float density = getResources().getDisplayMetrics().density; - - TypedValue outValue = new TypedValue(); - context.getTheme().resolveAttribute(android.R.attr.colorForeground, outValue, true); - final int themeForegroundColor = outValue.data; - - mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor, - DEFAULT_BOTTOM_BORDER_COLOR_ALPHA); - - mDefaultTabColorizer = new SimpleTabColorizer(); - mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR); - mDefaultTabColorizer.setDividerColors(setColorAlpha(themeForegroundColor, - DEFAULT_DIVIDER_COLOR_ALPHA)); - - mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density); - mBottomBorderPaint = new Paint(); - mBottomBorderPaint.setColor(mDefaultBottomBorderColor); - - mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density); - mSelectedIndicatorPaint = new Paint(); - - mDividerHeight = DEFAULT_DIVIDER_HEIGHT; - mDividerPaint = new Paint(); - mDividerPaint.setStrokeWidth((int) (DEFAULT_DIVIDER_THICKNESS_DIPS * density)); - } - - void setCustomTabColorizer(SlidingTabLayout.TabColorizer customTabColorizer) { - mCustomTabColorizer = customTabColorizer; - invalidate(); - } - - void setSelectedIndicatorColors(int... colors) { - // Make sure that the custom colorizer is removed - mCustomTabColorizer = null; - mDefaultTabColorizer.setIndicatorColors(colors); - invalidate(); - } - - void setDividerColors(int... colors) { - // Make sure that the custom colorizer is removed - mCustomTabColorizer = null; - mDefaultTabColorizer.setDividerColors(colors); - invalidate(); - } - - void onViewPagerPageChanged(int position, float positionOffset) { - mSelectedPosition = position; - mSelectionOffset = positionOffset; - invalidate(); - } - - @Override - protected void onDraw(Canvas canvas) { - final int height = getHeight(); - final int childCount = getChildCount(); - final int dividerHeightPx = (int) (Math.min(Math.max(0f, mDividerHeight), 1f) * height); - final SlidingTabLayout.TabColorizer tabColorizer = mCustomTabColorizer != null - ? mCustomTabColorizer - : mDefaultTabColorizer; - - // Thick colored underline below the current selection - if (childCount > 0) { - View selectedTitle = getChildAt(mSelectedPosition); - int left = selectedTitle.getLeft(); - int right = selectedTitle.getRight(); - int color = tabColorizer.getIndicatorColor(mSelectedPosition); - - if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) { - int nextColor = tabColorizer.getIndicatorColor(mSelectedPosition + 1); - if (color != nextColor) { - color = blendColors(nextColor, color, mSelectionOffset); - } - - // Draw the selection partway between the tabs - View nextTitle = getChildAt(mSelectedPosition + 1); - left = (int) (mSelectionOffset * nextTitle.getLeft() + - (1.0f - mSelectionOffset) * left); - right = (int) (mSelectionOffset * nextTitle.getRight() + - (1.0f - mSelectionOffset) * right); - } - - mSelectedIndicatorPaint.setColor(color); - - canvas.drawRect(left, height - mSelectedIndicatorThickness, right, - height, mSelectedIndicatorPaint); - } - - // Thin underline along the entire bottom edge - canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint); - - // Vertical separators between the titles - int separatorTop = (height - dividerHeightPx) / 2; - for (int i = 0; i < childCount - 1; i++) { - View child = getChildAt(i); - mDividerPaint.setColor(tabColorizer.getDividerColor(i)); - canvas.drawLine(child.getRight(), separatorTop, child.getRight(), - separatorTop + dividerHeightPx, mDividerPaint); - } - } - - /** - * Set the alpha value of the {@code color} to be the given {@code alpha} value. - */ - private static int setColorAlpha(int color, byte alpha) { - return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); - } - - /** - * Blend {@code color1} and {@code color2} using the given ratio. - * - * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend, - * 0.0 will return {@code color2}. - */ - private static int blendColors(int color1, int color2, float ratio) { - final float inverseRation = 1f - ratio; - float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); - float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); - float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); - return Color.rgb((int) r, (int) g, (int) b); - } - - private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { - private int[] mIndicatorColors; - private int[] mDividerColors; - - @Override - public final int getIndicatorColor(int position) { - return mIndicatorColors[position % mIndicatorColors.length]; - } - - @Override - public final int getDividerColor(int position) { - return mDividerColors[position % mDividerColors.length]; - } - - void setIndicatorColors(int... colors) { - mIndicatorColors = colors; - } - - void setDividerColors(int... colors) { - mDividerColors = colors; - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java index 9ca4624ec..8f7ae7321 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java @@ -16,6 +16,7 @@ package com.github.mobile.ui; import android.os.Bundle; +import android.support.design.widget.TabLayout; import android.support.v4.view.PagerAdapter; import android.view.View; import android.widget.TabHost.OnTabChangeListener; @@ -40,7 +41,7 @@ public abstract class TabPagerActivity extends PagerFragment implements OnTabChangeListener, TabContentFactory { @@ -25,7 +27,7 @@ public abstract class TabPagerFragment - - - - + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> + + + + + + @@ -52,5 +64,4 @@ style="@style/ListSpinner" android:layout_centerInParent="true" android:visibility="gone" /> - - \ No newline at end of file + \ No newline at end of file From 25ce35719633430287046bbf5aa890ab97b5a772 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 27 Jun 2015 21:28:25 +0200 Subject: [PATCH 0529/1055] Added the GitHub SDK by @alorma Updated the authentication to the new system --- app/build.gradle | 2 + app/src/main/AndroidManifest.xml | 47 +- .../github/mobile/accounts/LoginActivity.java | 445 +++++------------- app/src/main/res/layout/login.xml | 74 +-- app/src/main/res/menu/login.xml | 1 - app/src/main/res/values/config.xml | 14 + app/src/main/res/values/strings.xml | 2 + app/src/main/res/xml/authenticator.xml | 2 +- build.gradle | 1 + 9 files changed, 185 insertions(+), 403 deletions(-) create mode 100644 app/src/main/res/values/config.xml diff --git a/app/build.gradle b/app/build.gradle index 26a0aa212..f3a090f3e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,6 +42,8 @@ dependencies { compile ('com.google.inject.extensions:guice-assistedinject:3.0'){ exclude group: 'com.google.inject' } + + compile 'com.github.alorma:github-sdk:1.0.1@aar' compile 'com.viewpagerindicator:library:2.4.1@aar' compile 'com.squareup.okio:okio:1.1.0' compile 'com.squareup.retrofit:retrofit:1.9.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f89d56f60..332e14507 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,11 +24,13 @@ android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@style/Theme.GitHub"> + + @@ -229,12 +231,17 @@ + android:launchMode="singleInstance"> + + + + + + + + + - - - + + - - + + - - + + - - + + + + + + + + - + \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java index cff4b0bcb..893382d92 100644 --- a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java +++ b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java @@ -15,76 +15,54 @@ */ package com.github.mobile.accounts; -import static android.accounts.AccountManager.KEY_ACCOUNT_NAME; -import static android.accounts.AccountManager.KEY_ACCOUNT_TYPE; -import static android.accounts.AccountManager.KEY_AUTHTOKEN; -import static android.accounts.AccountManager.KEY_BOOLEAN_RESULT; import static android.content.Intent.ACTION_VIEW; import static android.content.Intent.CATEGORY_BROWSABLE; -import static android.text.InputType.TYPE_CLASS_TEXT; -import static android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD; -import static android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; -import static android.view.KeyEvent.ACTION_DOWN; -import static android.view.KeyEvent.KEYCODE_ENTER; -import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE; -import static com.github.mobile.RequestCodes.OTP_CODE_ENTER; -import static com.github.mobile.accounts.AccountConstants.ACCOUNT_TYPE; import static com.github.mobile.accounts.AccountConstants.PROVIDER_AUTHORITY; -import static com.github.mobile.accounts.TwoFactorAuthActivity.PARAM_EXCEPTION; -import static com.github.mobile.accounts.TwoFactorAuthClient.TWO_FACTOR_AUTH_TYPE_SMS; import android.accounts.Account; import android.accounts.AccountManager; import android.app.AlertDialog; +import android.app.Application; +import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; import android.content.Intent; +import android.content.pm.LabeledIntent; +import android.content.pm.ResolveInfo; +import android.net.Uri; import android.os.Bundle; -import android.text.Editable; -import android.text.Html; -import android.text.TextUtils; -import android.text.TextWatcher; -import android.text.method.LinkMovementMethod; +import android.support.v7.widget.Toolbar; import android.util.Log; -import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; -import android.view.View; -import android.view.View.OnKeyListener; -import android.widget.ArrayAdapter; -import android.widget.AutoCompleteTextView; -import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.EditText; -import android.widget.TextView; -import android.widget.TextView.OnEditorActionListener; - -import com.github.kevinsawicki.wishlist.ViewFinder; +import android.widget.Toast; + +import com.alorma.github.basesdk.ApiClient; +import com.alorma.github.basesdk.client.BaseClient; +import com.alorma.github.sdk.bean.dto.response.Token; +import com.alorma.github.sdk.login.AccountsHelper; +import com.alorma.github.sdk.security.GitHub; +import com.alorma.github.sdk.services.login.RequestTokenClient; +import com.alorma.github.sdk.services.user.GetAuthUserClient; import com.github.mobile.R; import com.github.mobile.persistence.AccountDataManager; import com.github.mobile.ui.LightProgressDialog; -import com.github.mobile.ui.TextWatcherAdapter; +import com.github.mobile.ui.MainActivity; import com.github.mobile.ui.roboactivities.RoboActionBarAccountAuthenticatorActivity; -import com.github.mobile.util.ToastUtils; import com.google.inject.Inject; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.eclipse.egit.github.core.User; -import org.eclipse.egit.github.core.client.GitHubClient; -import org.eclipse.egit.github.core.service.OAuthService; -import org.eclipse.egit.github.core.service.UserService; -import roboguice.util.RoboAsyncTask; +import retrofit.ErrorHandler; +import retrofit.RetrofitError; +import retrofit.client.Response; /** * Activity to login */ -public class LoginActivity extends RoboActionBarAccountAuthenticatorActivity { +public class LoginActivity extends RoboActionBarAccountAuthenticatorActivity implements BaseClient.OnResultCallback { /** * Auth token type parameter @@ -96,7 +74,7 @@ public class LoginActivity extends RoboActionBarAccountAuthenticatorActivity { */ public static final String PARAM_USERNAME = "username"; - private static final String PARAM_CONFIRMCREDENTIALS = "confirmCredentials"; + public static final String OAUTH_URL = "https://github.com/login/oauth/authorize"; private static final String TAG = "LoginActivity"; @@ -132,30 +110,15 @@ protected List run(Account account) throws Exception { private AccountManager accountManager; - private AutoCompleteTextView loginText; + private Account[] accounts; - private EditText passwordText; + private String accessToken; - private RoboAsyncTask authenticationTask; + private String scope; - private String authTokenType; + private RequestTokenClient requestTokenClient; - private MenuItem loginItem; - - /** - * If set we are just checking that the user knows their credentials; this - * doesn't cause the user's password to be changed on the device. - */ - private Boolean confirmCredentials = false; - - private String password; - - /** - * Was the original caller asking for an entirely new account? - */ - protected boolean requestNewAccount = false; - - private String username; + private AlertDialog progressDialog; @Override public void onCreate(Bundle savedInstanceState) { @@ -163,117 +126,59 @@ public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.login); - setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); accountManager = AccountManager.get(this); - ViewFinder finder = new ViewFinder(this); - loginText = finder.find(R.id.et_login); - passwordText = finder.find(R.id.et_password); - - final Intent intent = getIntent(); - username = intent.getStringExtra(PARAM_USERNAME); - authTokenType = intent.getStringExtra(PARAM_AUTHTOKEN_TYPE); - requestNewAccount = username == null; - confirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, - false); - - TextView signupText = finder.find(R.id.tv_signup); - signupText.setMovementMethod(LinkMovementMethod.getInstance()); - signupText.setText(Html.fromHtml(getString(R.string.signup_link))); - - if (!TextUtils.isEmpty(username)) { - loginText.setText(username); - loginText.setEnabled(false); - loginText.setFocusable(false); - } - - TextWatcher watcher = new TextWatcherAdapter() { - - @Override - public void afterTextChanged(Editable gitDirEditText) { - updateEnablement(); - } - }; - loginText.addTextChangedListener(watcher); - passwordText.addTextChangedListener(watcher); - - passwordText.setOnKeyListener(new OnKeyListener() { - - @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - if (event != null && ACTION_DOWN == event.getAction() - && keyCode == KEYCODE_ENTER && loginEnabled()) { - handleLogin(); - return true; - } else - return false; - } - }); - - passwordText.setOnEditorActionListener(new OnEditorActionListener() { - - @Override - public boolean onEditorAction(TextView v, int actionId, - KeyEvent event) { - if (actionId == IME_ACTION_DONE && loginEnabled()) { - handleLogin(); - return true; - } - return false; - } - }); - - CheckBox showPassword = finder.find(R.id.cb_show_password); - showPassword.setOnCheckedChangeListener(new OnCheckedChangeListener() { - - @Override - public void onCheckedChanged(CompoundButton buttonView, - boolean isChecked) { - int type = TYPE_CLASS_TEXT; - if (isChecked) - type |= TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; - else - type |= TYPE_TEXT_VARIATION_PASSWORD; - int selection = passwordText.getSelectionStart(); - passwordText.setInputType(type); - if (selection > 0) - passwordText.setSelection(selection); - } - }); + accounts = accountManager.getAccountsByType(getString(R.string.account_type)); - loginText.setAdapter(new ArrayAdapter<>(this, - android.R.layout.simple_dropdown_item_1line, - getEmailAddresses())); + if (accounts != null && accounts.length > 0) + openMain(); } @Override - protected void onResume() { - super.onResume(); - - // Finish task if valid account exists - if (requestNewAccount) { - Account existing = AccountUtils.getPasswordAccessibleAccount(this); - if (existing != null && !TextUtils.isEmpty(existing.name)) { - String password = AccountManager.get(this) - .getPassword(existing); - if (!TextUtils.isEmpty(password)) - finishLogin(existing.name, password); + protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + Uri uri = intent.getData(); + if(uri != null && uri.getScheme().equals(getString(R.string.github_oauth_scheme))){ + openLoadingDialog(); + String code = uri.getQueryParameter("code"); + + if (requestTokenClient == null) { + requestTokenClient = new RequestTokenClient(LoginActivity.this, code); + requestTokenClient.setOnResultCallback(new BaseClient.OnResultCallback() { + @Override + public void onResponseOk(Token token, Response r) { + if (token.access_token != null) { + endAccess(token.access_token, token.scope); + } else if (token.error != null) { + Toast.makeText(LoginActivity.this, token.error, Toast.LENGTH_LONG).show(); + progressDialog.dismiss(); + } + } + + @Override + public void onFail(RetrofitError error) { + error.printStackTrace(); + } + }); + requestTokenClient.execute(); } - return; } - - updateEnablement(); } - private boolean loginEnabled() { - return !TextUtils.isEmpty(loginText.getText()) - && !TextUtils.isEmpty(passwordText.getText()); + private void openMain() { + progressDialog.dismiss(); + Intent intent = new Intent(this, MainActivity.class); + startActivity(intent); + finish(); } - private void updateEnablement() { - if (loginItem != null) - loginItem.setEnabled(loginEnabled()); + private void openLoadingDialog() { + progressDialog = LightProgressDialog.create(this, + R.string.login_activity_authenticating); + progressDialog.show(); } @Override @@ -284,153 +189,41 @@ public void startActivity(Intent intent) { super.startActivity(intent); } - /** - * Authenticate login & password - */ public void handleLogin() { - if (requestNewAccount) - username = loginText.getText().toString(); - password = passwordText.getText().toString(); - - final AlertDialog dialog = LightProgressDialog.create(this, - R.string.login_activity_authenticating); - dialog.setCancelable(true); - dialog.setOnCancelListener(new OnCancelListener() { - - @Override - public void onCancel(DialogInterface dialog) { - if (authenticationTask != null) - authenticationTask.cancel(true); - } - }); - dialog.show(); - - authenticationTask = new RoboAsyncTask(this) { - - @Override - public User call() throws Exception { - GitHubClient client = new TwoFactorAuthClient(); - client.setCredentials(username, password); - - User user; - try { - user = new UserService(client).getUser(); - } catch (TwoFactorAuthException e) { - if (e.twoFactorAuthType == TWO_FACTOR_AUTH_TYPE_SMS) - sendSmsOtpCode(new OAuthService(client)); - openTwoFactorAuthActivity(); - - return null; - } - - Account account = new Account(user.getLogin(), ACCOUNT_TYPE); - if (requestNewAccount) { - accountManager - .addAccountExplicitly(account, password, null); - configureSyncFor(account); - try { - new AccountLoader(LoginActivity.this).call(); - } catch (IOException e) { - Log.d(TAG, "Exception loading organizations", e); - } - } else - accountManager.setPassword(account, password); + openLoginInBrowser(new GitHub(this)); + } - return user; - } + private void openLoginInBrowser(ApiClient client) { + String initialScope = "user,public_repo,repo,delete_repo,notifications,gist"; + final String url = String.format("%s?client_id=%s&scope=%s", + OAUTH_URL, client.getApiClient(), initialScope); - @Override - protected void onException(Exception e) throws RuntimeException { - dialog.dismiss(); + final List browserList = getBrowserList(); - Log.d(TAG, "Exception requesting authenticated user", e); - handleLoginException(e); - } + final List intentList = new ArrayList<>(); - @Override - public void onSuccess(User user) { - dialog.dismiss(); - - if (user != null) - onAuthenticationResult(true); - } - }; - authenticationTask.execute(); - } + for (final ResolveInfo resolveInfo : browserList) { + final Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + newIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, + resolveInfo.activityInfo.name)); - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - if (requestCode == OTP_CODE_ENTER) { - switch (resultCode) { - case RESULT_OK: - onAuthenticationResult(true); - break; - case RESULT_CANCELED: - Exception e = (Exception) data.getExtras().getSerializable(PARAM_EXCEPTION); - handleLoginException(e); - break; - } + intentList.add(new LabeledIntent(newIntent, + resolveInfo.resolvePackageName, + resolveInfo.labelRes, + resolveInfo.icon)); } - } - /** - * Called when response is received from the server for confirm credentials - * request. See onAuthenticationResult(). Sets the - * AccountAuthenticatorResult which is sent back to the caller. - * - * @param result - */ - protected void finishConfirmCredentials(boolean result) { - final Account account = new Account(username, ACCOUNT_TYPE); - accountManager.setPassword(account, password); - - final Intent intent = new Intent(); - intent.putExtra(KEY_BOOLEAN_RESULT, result); - setAccountAuthenticatorResult(intent.getExtras()); - setResult(RESULT_OK, intent); - finish(); - } + final Intent chooser = Intent.createChooser(intentList.remove(0), "Choose your favorite browser"); + LabeledIntent[] extraIntents = intentList.toArray( new LabeledIntent[ intentList.size() ]); + chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents); - /** - * Called when response is received from the server for authentication - * request. See onAuthenticationResult(). Sets the - * AccountAuthenticatorResult which is sent back to the caller. Also sets - * the authToken in AccountManager for this account. - * - * @param username - * @param password - */ - - protected void finishLogin(final String username, final String password) { - final Intent intent = new Intent(); - intent.putExtra(KEY_ACCOUNT_NAME, username); - intent.putExtra(KEY_ACCOUNT_TYPE, ACCOUNT_TYPE); - if (ACCOUNT_TYPE.equals(authTokenType)) - intent.putExtra(KEY_AUTHTOKEN, password); - setAccountAuthenticatorResult(intent.getExtras()); - setResult(RESULT_OK, intent); - finish(); + startActivity(chooser); } - /** - * Called when the authentication process completes (see attemptLogin()). - * - * @param result - */ - public void onAuthenticationResult(boolean result) { - if (result) { - if (!confirmCredentials) - finishLogin(username, password); - else - finishConfirmCredentials(true); - } else { - if (requestNewAccount) - ToastUtils.show(this, R.string.invalid_login_or_password); - else - ToastUtils.show(this, R.string.invalid_password); - } + private List getBrowserList() { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://sometesturl.com")); + + return getPackageManager().queryIntentActivities(intent, 0); } @Override @@ -446,37 +239,43 @@ public boolean onOptionsItemSelected(MenuItem item) { } @Override - public boolean onCreateOptionsMenu(Menu optionMenu) { - getMenuInflater().inflate(R.menu.login, optionMenu); - loginItem = optionMenu.findItem(R.id.m_login); - return true; - } + public void onResponseOk(com.alorma.github.sdk.bean.dto.response.User user, Response r) { + Account account = new Account(user.login, getString(R.string.account_type)); + Bundle userData = AccountsHelper.buildBundle(user.name, user.email, user.avatar_url, scope); + userData.putString(AccountManager.KEY_AUTHTOKEN, accessToken); - private List getEmailAddresses() { - final Account[] accounts = accountManager - .getAccountsByType("com.google"); - final List addresses = new ArrayList<>(accounts.length); - for (Account account : accounts) - addresses.add(account.name); - return addresses; + accountManager.addAccountExplicitly(account, null, userData); + accountManager.setAuthToken(account, getString(R.string.account_type), accessToken); + + Bundle result = new Bundle(); + result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); + result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type); + result.putString(AccountManager.KEY_AUTHTOKEN, accessToken); + + setAccountAuthenticatorResult(result); + + openMain(); } - private void sendSmsOtpCode(final OAuthService service) throws IOException { - try { - AccountAuthenticator.createAuthorization(service); - } catch (TwoFactorAuthException ignored) { - } + @Override + public void onFail(RetrofitError error) { + error.printStackTrace(); } - private void openTwoFactorAuthActivity() { - Intent intent = TwoFactorAuthActivity.createIntent(this, username, password); - startActivityForResult(intent, OTP_CODE_ENTER); + private void endAccess(String accessToken, String scope) { + this.accessToken = accessToken; + this.scope = scope; + + progressDialog.setMessage(getString(R.string.loading_user)); + + GetAuthUserClient userClient = new GetAuthUserClient(this, accessToken); + userClient.setOnResultCallback(this); + userClient.execute(); } - private void handleLoginException(final Exception e) { - if (AccountUtils.isUnauthorized(e)) - onAuthenticationResult(false); - else - ToastUtils.show(LoginActivity.this, e, R.string.code_authentication_failed); + @Override + public boolean onCreateOptionsMenu(Menu optionMenu) { + getMenuInflater().inflate(R.menu.login, optionMenu); + return true; } -} +} \ No newline at end of file diff --git a/app/src/main/res/layout/login.xml b/app/src/main/res/layout/login.xml index 200e87897..34ed6b4d8 100644 --- a/app/src/main/res/layout/login.xml +++ b/app/src/main/res/layout/login.xml @@ -20,73 +20,19 @@ android:orientation="vertical"> + android:background="?attr/colorPrimary" + android:id="@+id/toolbar" /> - - - - - - - - - - - - - - - - - - - + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:gravity="center_horizontal" + android:textColor="@color/primary_dark" + style="@style/TextAppearance.AppCompat.Subhead" + android:text="@string/temporary_login_message"/> + \ No newline at end of file diff --git a/app/src/main/res/menu/login.xml b/app/src/main/res/menu/login.xml index 8eaf258cf..10431cadc 100644 --- a/app/src/main/res/menu/login.xml +++ b/app/src/main/res/menu/login.xml @@ -19,7 +19,6 @@ diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml new file mode 100644 index 000000000..ba697a0c3 --- /dev/null +++ b/app/src/main/res/values/config.xml @@ -0,0 +1,14 @@ + + + com.github + + + + + + + + + //The thing before the "://..." in github_oauth, used for identifying the intent call + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index afb0b9dbf..58bbbdc1b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -107,6 +107,7 @@ Clear History Search history cleared Logging in… + Loading user profile… Creating Gist… Create Create Gist @@ -301,5 +302,6 @@ and comments, and remove all collaborator associations. Repository is deleted Login or Email + Authenticating is now done through the website, press the log in button to continue. diff --git a/app/src/main/res/xml/authenticator.xml b/app/src/main/res/xml/authenticator.xml index 5d240a3c9..b88f3ed45 100644 --- a/app/src/main/res/xml/authenticator.xml +++ b/app/src/main/res/xml/authenticator.xml @@ -15,7 +15,7 @@ limitations under the License. --> diff --git a/build.gradle b/build.gradle index 3ab7a44fb..1acd9436d 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,7 @@ allprojects { repositories { maven { url "http://dl.bintray.com/populov/maven" } maven { url "https://repo.eclipse.org/content/groups/releases" } + maven { url "http://dl.bintray.com/alorma/maven"} jcenter() } } From 498bc2dfd7d151fdfbbd527c91f5db4b50482191 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sun, 28 Jun 2015 08:40:21 +0200 Subject: [PATCH 0530/1055] Changed from string resource to BuildConfig (Add values to github.properties) --- .gitignore | 3 +++ app/build.gradle | 18 ++++++++++++++++-- .../github/mobile/accounts/LoginActivity.java | 15 +++++++++++---- app/src/main/res/values/config.xml | 10 ---------- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index eca7ba438..9ec56cba4 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ tmp/ # TeXlipse plugin .texlipse + +#GitHub application codes (local and personal) +github.properties \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index f3a090f3e..00adf24a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,6 +9,20 @@ android { targetSdkVersion 22 versionCode 1900 versionName '1.9.0' + + def Properties githubProps = new Properties() + githubProps.load(new FileInputStream(file('../github.properties'))) + + assert githubProps["GITHUB_SECRET"] + resValue "string", "github_secret", githubProps["GITHUB_SECRET"] + + assert githubProps["GITHUB_CLIENT"] + resValue "string", "github_client", githubProps["GITHUB_CLIENT"] + + assert githubProps["GITHUB_CALLBACK"] + def oauth = githubProps["GITHUB_CALLBACK"] + resValue "string", "github_oauth", oauth + resValue "string", "github_oauth_scheme", oauth.split("://")[0] } packagingOptions { @@ -33,7 +47,7 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.squareup.picasso:picasso:2.5.0' - compile 'com.squareup.okhttp:okhttp:2.3.0' + compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'org.roboguice:roboguice:2.0' compile 'com.github.kevinsawicki:http-request:5.6' compile 'com.google.code.gson:gson:2.3.1' @@ -55,4 +69,4 @@ dependencies { exclude group: 'commons-logging', module: 'commons-logging' exclude group: 'org.apache.httpcomponents', module: 'httpclient' } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java index 893382d92..a6aedf0e7 100644 --- a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java +++ b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java @@ -49,6 +49,7 @@ import com.github.mobile.ui.MainActivity; import com.github.mobile.ui.roboactivities.RoboActionBarAccountAuthenticatorActivity; import com.google.inject.Inject; +import com.squareup.okhttp.HttpUrl; import java.util.ArrayList; import java.util.List; @@ -74,7 +75,7 @@ public class LoginActivity extends RoboActionBarAccountAuthenticatorActivity imp */ public static final String PARAM_USERNAME = "username"; - public static final String OAUTH_URL = "https://github.com/login/oauth/authorize"; + public static final String OAUTH_HOST = "www.github.com"; private static final String TAG = "LoginActivity"; @@ -195,15 +196,21 @@ public void handleLogin() { private void openLoginInBrowser(ApiClient client) { String initialScope = "user,public_repo,repo,delete_repo,notifications,gist"; - final String url = String.format("%s?client_id=%s&scope=%s", - OAUTH_URL, client.getApiClient(), initialScope); + HttpUrl.Builder url = new HttpUrl.Builder() + .scheme("https") + .host(OAUTH_HOST) + .addPathSegment("login") + .addPathSegment("oauth") + .addPathSegment("authorize") + .addQueryParameter("client_id", client.getApiClient()) + .addQueryParameter("scope", initialScope); final List browserList = getBrowserList(); final List intentList = new ArrayList<>(); for (final ResolveInfo resolveInfo : browserList) { - final Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + final Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url.build().toString())); newIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name)); diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml index ba697a0c3..9254e5569 100644 --- a/app/src/main/res/values/config.xml +++ b/app/src/main/res/values/config.xml @@ -1,14 +1,4 @@ com.github - - - - - - - - - //The thing before the "://..." in github_oauth, used for identifying the intent call - \ No newline at end of file From 7f9c5e23c7da6ca57e48095c4c4b8ca7f6dfc325 Mon Sep 17 00:00:00 2001 From: Yuliya-Kaleda Date: Sun, 28 Jun 2015 19:59:23 -0400 Subject: [PATCH 0531/1055] log out in the navigation drawer --- app/src/main/AndroidManifest.xml | 3 ++- .../com/github/mobile/ui/MainActivity.java | 27 +++++++++++++++++++ .../mobile/ui/NavigationDrawerAdapter.java | 2 +- .../mobile/ui/NavigationDrawerObject.java | 1 + app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/typeface.xml | 1 + 6 files changed, 33 insertions(+), 2 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f89d56f60..b4d628c9f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -229,7 +229,8 @@ + android:excludeFromRecents="true" + android:noHistory="true"> - Hesap & Kurumları Yükleme Başarısız Oldu - Sorunları Yükleme Başarısız Oldu - Depoları Yükleme Başarısız Oldu - Depo Yükleme Başarısız Oldu - Gist Yükleme Başarısız Oldu - Haberleri Yükleme Başarısız Oldu - Takipçileri Yükleme Başarısız Oldu - Kişileri Yükleme Başarısız Oldu - Kişiyi Yükleme Başarısız Oldu - Gist İçeriği Yükleme Başarısız Oldu - Gist\'leri Yükleme Başarısız Oldu - Sorun Yükleme Başarısız Oldu - Ortak Çalışanları Yükleme Başarısız Oldu - Dönüm Noktalarını Yükleme Başarısız Oldu - Etiketleri Yükleme Başarısız Oldu - Yer İmlerini Yükleme Başarısız Oldu - Üyeleri Yükleme Başarısız Oldu - Onaylamaları Yükleme Başarısız Oldu - Onaylamayı Yükleme Başarısız Oldu - Dosya Yükleme Başarısız Oldu - Kod Yükleme Başarısız Oldu - Dalları & Etiketleri Yükleme Başarısız Oldu - Takip Etme Başarısız Oldu - Takip Etmeyi Bırakma Başarısız Oldu - Takip Etme Kontrolü Başarısız Oldu - Yıldız Koyma Başarısız Oldu - Yıldızı Kaldırma Başarısız Oldu - Yıldız Durumunu Kontrol Etme Başarısız Oldu - Markdown dosyası render edilemdi + Hesap ve organizasyonlar yüklenemedi + Sorunlar yüklenemedi + Projeler yüklenemedi + Proje yüklenemedi + Destekçiler yüklenemedi + Gist yüklenemedi + Haberler yüklenemedi + Takipçiler yüklenemedi + Kişiler yüklenemedi + Kişi yüklenemedi + Gist dosya içeriği yüklenemedi + Gist\'ler yüklenemedi + Sorun yüklenemedi + Birlikte çalışılanlar yüklenemedi + Dönüm noktaları yüklenemedi + Etiketler yüklenemedi + Yer imleri yüklenemedi + Üyeler yüklenemedi + Gönderimler yüklenemedi + Gönderim yüklenemedi + Dosya yüklenemedi + Kod yüklenemedi + Etiket ve ayrımlar yüklenemedi + Takip etme başarısız + Takibi bırakma başarısız + Takip durumunu kontrolü başarısız + Favorilere ekleme başarısız + Favorilerden kaldırma başarısız + Kopyalama başarısız + Silme başarısız + Favorileme durumunu kontrol etme başarısız + Markdown görüntüleme başarısız + Kullanıcı arama başarısız - Gist Yükleniyor… - Rastgele Gist Yükleniyor… - Daha Fazla Sorun Yükleniyor… - Sorunlar Yükleniyor… - Yorumlar Yükleniyor… - Depolar Yükleniyor… - Sorun Yükleniyor… - Haberler Yükleniyor… - Takipçiler Yükleniyor… - Kişiler Yükleniyor… - Gist\'ler Yükleniyor… - Ortak Çalışanlar Yükleniyor… - Dönüm Noktaları Yükleniyor… - Etiketler Yükleniyor… - Onaylamalar Yükleniyor… - Dosya & Yorumlar Yükleniyor… - Dallar & Etiketler Yükleniyor… + Gist yükleniyor… + Rastgele Gist yükleniyor… + Daha fazla sorun yükleniyor… + Sorunlar yükleniyor… + Yorumlar yükleniyor… + Projeler yükleniyor… + Sorun yükleniyor… + Haberler yükleniyor… + Takipçiler yükleniyor… + Kişiler yükleniyor… + Gist\'ler yükleniyor… + Birlikte çalışılanlar yükleniyor… + Dönüm noktaları yükleniyor… + Etiketler yükleniyor… + Gönderimler yükleniyor… + Dosyalar ve yorumlar yükleniyor… + Ayrımlar ve etiketler yükleniyor… - - Yer İmi Yok - Depo Yok - Sorun Yok - Gist Yok - Kişi Yok - Takipçi Yok - Üye Yok - Haber - Onaylama Yok + + Yer imi yok + Proje yok + Sorun yok + Gist yok + Kişi yok + Takipçi yok + Üye yok + Haber yok + Gönderim yok + - Atanan Güncelleniyor… - Sorun Güncelleniyor… - Etiketler Güncelleniyor… - Dönüm Noktası Güncelleniyor… + Atanan güncelleniyor… + Sorun güncelleniyor… + Etiketler güncelleniyor… + Dönüm noktası güncelleniyor… GitHub + Ana sayfa Haberler Sorunlar Gist\'ler - Onaylamalar - Depo Bul + Gönderimler + GitHub arama + Proje Bul Sorun Bul Ara… Geçmişi Sil Arama geçmişi silindi - Giriş yapılıyor… - Gist Oluşturuluyor… + Giriş yapılıyor … + Gist oluşturuluyor… Oluştur Gist Oluştur - puts \'Merhaba Dünya!\' + \'Hello World!\' yazar Bu Gist\'i herkese açık yap - dosya.rb + file.rb Gist Yorumlar Dosyalar @@ -115,75 +121,89 @@ Dosya Adı Dosya İçeriği Yeni Gist - Filtre - Yer İmi - Yorum + Filtrele + Yer imlerine ekle + Yorum yaz Sil + SİL Yenile - Sorun Kontrol Paneli - Yer İmleri - Gist\'ler + Sorun Paneli + Yer imleri + Gist\’ler Sorun # Çekme Talebi # Gist\u0020 Sorunları Filtrele - Yorum Oluştur - Bir yorum gir - Daha Fazla Göster… - Depolar + Yorum yaz + Bir yorum yazın + Daha fazla… + Projeler + Katkı verenler Sorunlar - Etiketleri Düzenle - Dönüm Noktası + Etiketleri düzenle + Dönüm Noktası: Dönüm Noktası Düzenle Atanan Düzenle Tanım Android Gist oluşturdu Başlık Düzenle - Gist Yıldızlanıyor… - Gist\'in Yıldızı Kaldırılıyor… + Gist Favorilere Ekleniyor… + Gist Favorilerden Kaldırılıyor… Hesaplar - Atanmış Seç + Atanan Seç Dönüm Noktası Seç - Etiket Seç - Bir Dal Veya Etiket Seç - Dönüm Noktası Yok - Kimse Atanmamış - atanmış - Hiç Gist bulunamadı - Silmeyi Onayla + Etiketleri Seç + Etiket ya da Ayrım Seç + Onay kodu + Hesabınız için iki aşamalı onay etkinleştirildi. Kimliğinizi doğrulamak için onay kodunuzu giriniz. + Dönüm noktası yok + Kimse atanmadı + atandı + Gist bulunamadı + Silmeyi onayla Bu Gist\'i silmek istediğinizden emin misiniz? Gist Siliniyor… - Yorum Oluşturuluyor… - Bu yer imini kaldırmak istediğinizden emin misiniz? - Sorun Kontrol Paneli + Yorum oluşturuluyor… + Yorum düzenleniyor… + Yorum siliniyor… + Yorumu kaldır + ABu yorumu silmek istediğinizden emin misiniz? + Bu yer imini silmek istediğinizden emin misiniz? + Sorun Paneli Yeni Sorun Anonim - Sorun filtresi yer imlerine kaydedildi - Yakın Zamanda + Sorun filtresi yer imlerine eklendi + SON GÖRÜNTÜLENENLER + En Son + En Sonu Kaldır + Son görüntülenlerden kaldır Durum: Açık - Kapanmış - Şu Kişiye Atanmış : - Herhangi Biri + Kapalı + Atandı: + Herhangi biri Dönüm Noktası: Hiç Etiketler: Giriş yap - GitHub\'ın yenisi misin? <a href=\"https://github.com/join\">Buraya tıkla</a> kayıt olmak için - GitHub\'a bağlanılamadı + GitHub\'a yeni misin? <a href=\"https://github.com/join\">Buraya tıkla</a> kayıt olmak için + Emin değil misin? <a href=\"https://help.github.com/articles/about-two-factor-authentication\">Yardım al.</a> + GitHub\’a bağlanılamadı + Onay başarısız. Hatalı kod Lütfen geçerli bir kullanıcı adı & şifre girin Lütfen geçerli bir şifre girin. Şifre - Kullanıcı Adı veya Email + Kullanıcı adı veya eposta Takipçiler Takip Ettikleri Takipçilerim Takip Ettiklerim Takip Et Takip Etmeyi Bırak - Yıldızla - Yıldızı Kaldır + Favorilere ekle + Favorilerden çıkar + Kopyala Üyeler Sorun Kapatılıyor… Sorun Tekrar Açılıyor… @@ -193,6 +213,7 @@ güncellendi\u0020 açıldı\u0020 Temizle + Gönderimler: %d Açık Sorunlar Kapanmış Sorunlar Yer İmini Kaldır @@ -212,8 +233,8 @@ Tekrar Aç Geçersiz GitHub URL\'i Belirtilen URL bu uygulama ile açılamadı:\n{0} - YAKIN ZAMANDA GÖRÜNTÜLENENLER İptal + EMİN DEĞİLİM Uygulama Çakışması Kurulu olan başka bir uygulama GitHub kimlik doğrulaması için ayarlanmış.\n\nGitHub uygulamasının tekrar kullanılabilmesi için diğer uygulamayı Hesaplardan & eş zamanlama ayarlarından kaldırmanız gerekmekte. Açılıyor {0}… @@ -229,36 +250,56 @@ Sözcük Kaydır Sözcük Kaydırmayı Kapat Kod - Takip Edilme İşlemi Devam Ediyor… - Takip Edilme Kaldırılıyor… - Yıldız Konuyor… - Yıldız Kaldırılıyor… - Yönlendiriliyor… + Takip ediliyor… + Takiptek çıkartılıyor… + Favorilere ekleniyor… + Favorilerden çıkartılıyor… + Kopyalanıyor… + Siliniyor… + Navigate to… + Ziyaret et %s + %d gönderim - Depolar - Haberler - Takip Ettiklerim - Takip Edenler - Takip Ettikleri - Takip Edenler - Üyeler - Kod - Onaylamalar - Durumlar - İzlediklerim - Atandıklarım - Yaratılanlar - Bahsedilenler - Benim - Yıldızladıklarım - Hepsi + projeler + kullanıcılar + haberler + takip edilenler + takipçiler + takip edilenler + takipçiler + üyeler + kod + gönderim + sorunlar + izlenenler + atananlar + oluşturuldu + bahsedildi + benim + favoriler + hepsi Paylaş - Şifre Göster + Şifreyi göster Yaz - Önizleme - Ham markdown dosyasını göster - Markdown dosyasını renderla + Önizle + Orjinal markdown göster + Markdown görüntüle + Hash\’i kopyala + Hafızaya kopyala + + + Navigasyon çekmecesini aç + Navigasyon çekmecesini kapat + Alt başlık + + + Kesinlikle emin misiniz? + Bu hareket geri ALINAMAZ. + Bu projeniz, wiki, sorunlar, + and yorumlar, ve tüm katkı sağlayanlar ile bağınızı silecek. + Proje silindi + Giriş ya da Eposta From 84a3fd47eabe030fcf4d8fe788c83f216ea41f9b Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 1 Jul 2015 12:47:24 +0200 Subject: [PATCH 0533/1055] Renamed "item" to "position". The naturalize tool detected that using "position" is more consistent with the current codebase state: * "position" in CommitPagerAdapter is 85,81% probable ("identitiy" 4,08%) --- .../java/com/github/mobile/ui/commit/CommitPagerAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitPagerAdapter.java b/app/src/main/java/com/github/mobile/ui/commit/CommitPagerAdapter.java index 381655bf7..37d402b8d 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitPagerAdapter.java +++ b/app/src/main/java/com/github/mobile/ui/commit/CommitPagerAdapter.java @@ -48,9 +48,9 @@ public CommitPagerAdapter(ActionBarActivity activity, } @Override - public Fragment getItem(final int item) { + public Fragment getItem(final int position) { Bundle arguments = new Bundle(); - arguments.putString(EXTRA_BASE, ids[item].toString()); + arguments.putString(EXTRA_BASE, ids[position].toString()); arguments.putSerializable(EXTRA_REPOSITORY, repository); CommitDiffListFragment fragment = new CommitDiffListFragment(); fragment.setArguments(arguments); From 2f4e15053e59fe81553071280b9c2e8c5df6cb2a Mon Sep 17 00:00:00 2001 From: Sigee Date: Fri, 10 Jul 2015 13:11:40 +0200 Subject: [PATCH 0534/1055] Some hungarian translates. --- app/src/main/res/values-hu/strings.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 0d369a9e4..c0c4dc785 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -215,5 +215,20 @@ {0} commit összehasonlítása Sortörés engedélyezése Sortörés tiltása + Főoldal + Felhasynálónév vagy E-mail cím + Hírek + Tárolók + Felhasználók + Követők + Kód + Minden + Csillagozottak + Tagok + Követés + Követett felhasználók + Teljesen biztos vagy benne? + Kód + Hash másolása From a7401e5091c06c68fae499ea1972b40143c66fa9 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 11 Jul 2015 14:20:36 +0200 Subject: [PATCH 0535/1055] Added log message if build value is not found Moved from browser to WebView for authentication Added disclaimer for third-party restrictions Updated two libs (It changes nothing) --- app/build.gradle | 35 ++++++---- app/src/main/AndroidManifest.xml | 2 + .../github/mobile/accounts/LoginActivity.java | 67 ++++++------------- .../mobile/accounts/LoginWebViewActivity.java | 36 ++++++++++ app/src/main/res/layout/login.xml | 4 +- app/src/main/res/values/strings.xml | 7 +- 6 files changed, 91 insertions(+), 60 deletions(-) create mode 100644 app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java diff --git a/app/build.gradle b/app/build.gradle index 00adf24a8..0ac8207b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion '22.0.1' + defaultConfig { applicationId 'com.github.mobile' minSdkVersion 15 @@ -11,18 +12,17 @@ android { versionName '1.9.0' def Properties githubProps = new Properties() - githubProps.load(new FileInputStream(file('../github.properties'))) - - assert githubProps["GITHUB_SECRET"] - resValue "string", "github_secret", githubProps["GITHUB_SECRET"] + if(file('../github.properties').exists()) { + githubProps.load(new FileInputStream(file('../github.properties'))) - assert githubProps["GITHUB_CLIENT"] - resValue "string", "github_client", githubProps["GITHUB_CLIENT"] + resValue "string", "github_secret", getValue(githubProps, "GITHUB_SECRET") + resValue "string", "github_client", getValue(githubProps, "GITHUB_CLIENT") - assert githubProps["GITHUB_CALLBACK"] - def oauth = githubProps["GITHUB_CALLBACK"] - resValue "string", "github_oauth", oauth - resValue "string", "github_oauth_scheme", oauth.split("://")[0] + def oauth = getValue(githubProps, "GITHUB_CALLBACK") + resValue "string", "github_oauth", oauth + resValue "string", "github_oauth_scheme", oauth != "DEFAULT" ? oauth.split("://")[0] : oauth + } else + logger.log(LogLevel.ERROR, "github.properties can not be found, please add it to the project root") } packagingOptions { @@ -43,16 +43,27 @@ repositories { } } +def getValue(def props, def name){ + if(props[name]) + return props[name] + else if(System.getenv(name)) + return System.getenv(name) + else { + logger.log(LogLevel.ERROR, name + " has not been provided, add it to your github.properties file") + return "DEFAULT" + } +} + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.0.0' + compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.squareup.picasso:picasso:2.5.0' compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'org.roboguice:roboguice:2.0' compile 'com.github.kevinsawicki:http-request:5.6' compile 'com.google.code.gson:gson:2.3.1' compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.7.0.201502260915-r' - compile 'com.android.support:support-v4:22.0.0' + compile 'com.android.support:support-v4:22.2.0' compile ('com.google.inject.extensions:guice-assistedinject:3.0'){ exclude group: 'com.google.inject' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 332e14507..1c344f94f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -346,6 +346,8 @@ + + () { @Override public void onResponseOk(Token token, Response r) { if (token.access_token != null) { - endAccess(token.access_token, token.scope); + endAuth(token.access_token, token.scope); } else if (token.error != null) { Toast.makeText(LoginActivity.this, token.error, Toast.LENGTH_LONG).show(); progressDialog.dismiss(); @@ -170,7 +169,8 @@ public void onFail(RetrofitError error) { } private void openMain() { - progressDialog.dismiss(); + if(progressDialog != null) + progressDialog.dismiss(); Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); @@ -182,14 +182,6 @@ private void openLoadingDialog() { progressDialog.show(); } - @Override - public void startActivity(Intent intent) { - if (intent != null && ACTION_VIEW.equals(intent.getAction())) - intent.addCategory(CATEGORY_BROWSABLE); - - super.startActivity(intent); - } - public void handleLogin() { openLoginInBrowser(new GitHub(this)); } @@ -205,32 +197,16 @@ private void openLoginInBrowser(ApiClient client) { .addQueryParameter("client_id", client.getApiClient()) .addQueryParameter("scope", initialScope); - final List browserList = getBrowserList(); - - final List intentList = new ArrayList<>(); - - for (final ResolveInfo resolveInfo : browserList) { - final Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url.build().toString())); - newIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, - resolveInfo.activityInfo.name)); - - intentList.add(new LabeledIntent(newIntent, - resolveInfo.resolvePackageName, - resolveInfo.labelRes, - resolveInfo.icon)); - } - - final Intent chooser = Intent.createChooser(intentList.remove(0), "Choose your favorite browser"); - LabeledIntent[] extraIntents = intentList.toArray( new LabeledIntent[ intentList.size() ]); - chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents); - - startActivity(chooser); + Intent intent = new Intent(this, LoginWebViewActivity.class); + intent.putExtra(INTENT_EXTRA_URL, url.toString()); + startActivityForResult(intent, WEBVIEW_REQUEST_CODE); } - private List getBrowserList() { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://sometesturl.com")); - - return getPackageManager().queryIntentActivities(intent, 0); + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if(requestCode == WEBVIEW_REQUEST_CODE && resultCode == RESULT_OK) + onUserLoggedIn(data.getData()); } @Override @@ -242,7 +218,6 @@ public boolean onOptionsItemSelected(MenuItem item) { default: return super.onOptionsItemSelected(item); } - } @Override @@ -269,7 +244,7 @@ public void onFail(RetrofitError error) { error.printStackTrace(); } - private void endAccess(String accessToken, String scope) { + private void endAuth(String accessToken, String scope) { this.accessToken = accessToken; this.scope = scope; diff --git a/app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java b/app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java new file mode 100644 index 000000000..ec37c98f1 --- /dev/null +++ b/app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java @@ -0,0 +1,36 @@ +package com.github.mobile.accounts; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.webkit.WebViewClient; + +import com.github.mobile.R; +import com.github.mobile.ui.WebView; + +public class LoginWebViewActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + WebView webView = new WebView(this); + webView.loadUrl(getIntent().getStringExtra(LoginActivity.INTENT_EXTRA_URL)); + webView.setWebViewClient(new WebViewClient() { + @Override + public boolean shouldOverrideUrlLoading(android.webkit.WebView view, String url) { + Uri uri = Uri.parse(url); + if (uri.getScheme().equals(getString(R.string.github_oauth_scheme))) { + Intent data = new Intent(); + data.setData(uri); + setResult(RESULT_OK, data); + finish(); + return true; + } + return super.shouldOverrideUrlLoading(view, url); + } + }); + + setContentView(webView); + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/login.xml b/app/src/main/res/layout/login.xml index 34ed6b4d8..f92600280 100644 --- a/app/src/main/res/layout/login.xml +++ b/app/src/main/res/layout/login.xml @@ -34,5 +34,7 @@ android:gravity="center_horizontal" android:textColor="@color/primary_dark" style="@style/TextAppearance.AppCompat.Subhead" - android:text="@string/temporary_login_message"/> + android:text="@string/temporary_login_message" + android:linksClickable="true" + android:autoLink="web"/> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 58bbbdc1b..4afe9492b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -302,6 +302,11 @@ and comments, and remove all collaborator associations. Repository is deleted Login or Email - Authenticating is now done through the website, press the log in button to continue. + + Authenticating is now done through the website, + press the log in button to continue. + \n\n Since GitHub has added third-party restrictions we are unable to write + to certain organizations. You can read more here:\n + https://help.github.com/articles/about-third-party-application-restrictions/ From 275e563360d1f22d76c66eecd8aeab697a130fae Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 27 Jun 2015 21:28:25 +0200 Subject: [PATCH 0536/1055] Added the GitHub SDK by @alorma Updated the authentication to the new system --- app/build.gradle | 2 + app/src/main/AndroidManifest.xml | 47 +- .../github/mobile/accounts/LoginActivity.java | 445 +++++------------- app/src/main/res/layout/login.xml | 74 +-- app/src/main/res/menu/login.xml | 1 - app/src/main/res/values/config.xml | 14 + app/src/main/res/values/strings.xml | 2 + app/src/main/res/xml/authenticator.xml | 2 +- build.gradle | 1 + 9 files changed, 185 insertions(+), 403 deletions(-) create mode 100644 app/src/main/res/values/config.xml diff --git a/app/build.gradle b/app/build.gradle index f3c9762f6..f2313ffa5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,6 +42,8 @@ dependencies { compile ('com.google.inject.extensions:guice-assistedinject:3.0'){ exclude group: 'com.google.inject' } + + compile 'com.github.alorma:github-sdk:1.0.1@aar' compile 'com.viewpagerindicator:library:2.4.1@aar' compile 'com.squareup.okio:okio:1.1.0' compile 'com.squareup.retrofit:retrofit:1.9.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f89d56f60..332e14507 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,11 +24,13 @@ android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@style/Theme.GitHub"> + + @@ -229,12 +231,17 @@ + android:launchMode="singleInstance"> + + + + + + + + + - - - + + - - + + - - + + - - + + + + + + + + - + \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java index cff4b0bcb..893382d92 100644 --- a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java +++ b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java @@ -15,76 +15,54 @@ */ package com.github.mobile.accounts; -import static android.accounts.AccountManager.KEY_ACCOUNT_NAME; -import static android.accounts.AccountManager.KEY_ACCOUNT_TYPE; -import static android.accounts.AccountManager.KEY_AUTHTOKEN; -import static android.accounts.AccountManager.KEY_BOOLEAN_RESULT; import static android.content.Intent.ACTION_VIEW; import static android.content.Intent.CATEGORY_BROWSABLE; -import static android.text.InputType.TYPE_CLASS_TEXT; -import static android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD; -import static android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; -import static android.view.KeyEvent.ACTION_DOWN; -import static android.view.KeyEvent.KEYCODE_ENTER; -import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE; -import static com.github.mobile.RequestCodes.OTP_CODE_ENTER; -import static com.github.mobile.accounts.AccountConstants.ACCOUNT_TYPE; import static com.github.mobile.accounts.AccountConstants.PROVIDER_AUTHORITY; -import static com.github.mobile.accounts.TwoFactorAuthActivity.PARAM_EXCEPTION; -import static com.github.mobile.accounts.TwoFactorAuthClient.TWO_FACTOR_AUTH_TYPE_SMS; import android.accounts.Account; import android.accounts.AccountManager; import android.app.AlertDialog; +import android.app.Application; +import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; import android.content.Intent; +import android.content.pm.LabeledIntent; +import android.content.pm.ResolveInfo; +import android.net.Uri; import android.os.Bundle; -import android.text.Editable; -import android.text.Html; -import android.text.TextUtils; -import android.text.TextWatcher; -import android.text.method.LinkMovementMethod; +import android.support.v7.widget.Toolbar; import android.util.Log; -import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; -import android.view.View; -import android.view.View.OnKeyListener; -import android.widget.ArrayAdapter; -import android.widget.AutoCompleteTextView; -import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.EditText; -import android.widget.TextView; -import android.widget.TextView.OnEditorActionListener; - -import com.github.kevinsawicki.wishlist.ViewFinder; +import android.widget.Toast; + +import com.alorma.github.basesdk.ApiClient; +import com.alorma.github.basesdk.client.BaseClient; +import com.alorma.github.sdk.bean.dto.response.Token; +import com.alorma.github.sdk.login.AccountsHelper; +import com.alorma.github.sdk.security.GitHub; +import com.alorma.github.sdk.services.login.RequestTokenClient; +import com.alorma.github.sdk.services.user.GetAuthUserClient; import com.github.mobile.R; import com.github.mobile.persistence.AccountDataManager; import com.github.mobile.ui.LightProgressDialog; -import com.github.mobile.ui.TextWatcherAdapter; +import com.github.mobile.ui.MainActivity; import com.github.mobile.ui.roboactivities.RoboActionBarAccountAuthenticatorActivity; -import com.github.mobile.util.ToastUtils; import com.google.inject.Inject; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.eclipse.egit.github.core.User; -import org.eclipse.egit.github.core.client.GitHubClient; -import org.eclipse.egit.github.core.service.OAuthService; -import org.eclipse.egit.github.core.service.UserService; -import roboguice.util.RoboAsyncTask; +import retrofit.ErrorHandler; +import retrofit.RetrofitError; +import retrofit.client.Response; /** * Activity to login */ -public class LoginActivity extends RoboActionBarAccountAuthenticatorActivity { +public class LoginActivity extends RoboActionBarAccountAuthenticatorActivity implements BaseClient.OnResultCallback { /** * Auth token type parameter @@ -96,7 +74,7 @@ public class LoginActivity extends RoboActionBarAccountAuthenticatorActivity { */ public static final String PARAM_USERNAME = "username"; - private static final String PARAM_CONFIRMCREDENTIALS = "confirmCredentials"; + public static final String OAUTH_URL = "https://github.com/login/oauth/authorize"; private static final String TAG = "LoginActivity"; @@ -132,30 +110,15 @@ protected List run(Account account) throws Exception { private AccountManager accountManager; - private AutoCompleteTextView loginText; + private Account[] accounts; - private EditText passwordText; + private String accessToken; - private RoboAsyncTask authenticationTask; + private String scope; - private String authTokenType; + private RequestTokenClient requestTokenClient; - private MenuItem loginItem; - - /** - * If set we are just checking that the user knows their credentials; this - * doesn't cause the user's password to be changed on the device. - */ - private Boolean confirmCredentials = false; - - private String password; - - /** - * Was the original caller asking for an entirely new account? - */ - protected boolean requestNewAccount = false; - - private String username; + private AlertDialog progressDialog; @Override public void onCreate(Bundle savedInstanceState) { @@ -163,117 +126,59 @@ public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.login); - setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); accountManager = AccountManager.get(this); - ViewFinder finder = new ViewFinder(this); - loginText = finder.find(R.id.et_login); - passwordText = finder.find(R.id.et_password); - - final Intent intent = getIntent(); - username = intent.getStringExtra(PARAM_USERNAME); - authTokenType = intent.getStringExtra(PARAM_AUTHTOKEN_TYPE); - requestNewAccount = username == null; - confirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, - false); - - TextView signupText = finder.find(R.id.tv_signup); - signupText.setMovementMethod(LinkMovementMethod.getInstance()); - signupText.setText(Html.fromHtml(getString(R.string.signup_link))); - - if (!TextUtils.isEmpty(username)) { - loginText.setText(username); - loginText.setEnabled(false); - loginText.setFocusable(false); - } - - TextWatcher watcher = new TextWatcherAdapter() { - - @Override - public void afterTextChanged(Editable gitDirEditText) { - updateEnablement(); - } - }; - loginText.addTextChangedListener(watcher); - passwordText.addTextChangedListener(watcher); - - passwordText.setOnKeyListener(new OnKeyListener() { - - @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - if (event != null && ACTION_DOWN == event.getAction() - && keyCode == KEYCODE_ENTER && loginEnabled()) { - handleLogin(); - return true; - } else - return false; - } - }); - - passwordText.setOnEditorActionListener(new OnEditorActionListener() { - - @Override - public boolean onEditorAction(TextView v, int actionId, - KeyEvent event) { - if (actionId == IME_ACTION_DONE && loginEnabled()) { - handleLogin(); - return true; - } - return false; - } - }); - - CheckBox showPassword = finder.find(R.id.cb_show_password); - showPassword.setOnCheckedChangeListener(new OnCheckedChangeListener() { - - @Override - public void onCheckedChanged(CompoundButton buttonView, - boolean isChecked) { - int type = TYPE_CLASS_TEXT; - if (isChecked) - type |= TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; - else - type |= TYPE_TEXT_VARIATION_PASSWORD; - int selection = passwordText.getSelectionStart(); - passwordText.setInputType(type); - if (selection > 0) - passwordText.setSelection(selection); - } - }); + accounts = accountManager.getAccountsByType(getString(R.string.account_type)); - loginText.setAdapter(new ArrayAdapter<>(this, - android.R.layout.simple_dropdown_item_1line, - getEmailAddresses())); + if (accounts != null && accounts.length > 0) + openMain(); } @Override - protected void onResume() { - super.onResume(); - - // Finish task if valid account exists - if (requestNewAccount) { - Account existing = AccountUtils.getPasswordAccessibleAccount(this); - if (existing != null && !TextUtils.isEmpty(existing.name)) { - String password = AccountManager.get(this) - .getPassword(existing); - if (!TextUtils.isEmpty(password)) - finishLogin(existing.name, password); + protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + Uri uri = intent.getData(); + if(uri != null && uri.getScheme().equals(getString(R.string.github_oauth_scheme))){ + openLoadingDialog(); + String code = uri.getQueryParameter("code"); + + if (requestTokenClient == null) { + requestTokenClient = new RequestTokenClient(LoginActivity.this, code); + requestTokenClient.setOnResultCallback(new BaseClient.OnResultCallback() { + @Override + public void onResponseOk(Token token, Response r) { + if (token.access_token != null) { + endAccess(token.access_token, token.scope); + } else if (token.error != null) { + Toast.makeText(LoginActivity.this, token.error, Toast.LENGTH_LONG).show(); + progressDialog.dismiss(); + } + } + + @Override + public void onFail(RetrofitError error) { + error.printStackTrace(); + } + }); + requestTokenClient.execute(); } - return; } - - updateEnablement(); } - private boolean loginEnabled() { - return !TextUtils.isEmpty(loginText.getText()) - && !TextUtils.isEmpty(passwordText.getText()); + private void openMain() { + progressDialog.dismiss(); + Intent intent = new Intent(this, MainActivity.class); + startActivity(intent); + finish(); } - private void updateEnablement() { - if (loginItem != null) - loginItem.setEnabled(loginEnabled()); + private void openLoadingDialog() { + progressDialog = LightProgressDialog.create(this, + R.string.login_activity_authenticating); + progressDialog.show(); } @Override @@ -284,153 +189,41 @@ public void startActivity(Intent intent) { super.startActivity(intent); } - /** - * Authenticate login & password - */ public void handleLogin() { - if (requestNewAccount) - username = loginText.getText().toString(); - password = passwordText.getText().toString(); - - final AlertDialog dialog = LightProgressDialog.create(this, - R.string.login_activity_authenticating); - dialog.setCancelable(true); - dialog.setOnCancelListener(new OnCancelListener() { - - @Override - public void onCancel(DialogInterface dialog) { - if (authenticationTask != null) - authenticationTask.cancel(true); - } - }); - dialog.show(); - - authenticationTask = new RoboAsyncTask(this) { - - @Override - public User call() throws Exception { - GitHubClient client = new TwoFactorAuthClient(); - client.setCredentials(username, password); - - User user; - try { - user = new UserService(client).getUser(); - } catch (TwoFactorAuthException e) { - if (e.twoFactorAuthType == TWO_FACTOR_AUTH_TYPE_SMS) - sendSmsOtpCode(new OAuthService(client)); - openTwoFactorAuthActivity(); - - return null; - } - - Account account = new Account(user.getLogin(), ACCOUNT_TYPE); - if (requestNewAccount) { - accountManager - .addAccountExplicitly(account, password, null); - configureSyncFor(account); - try { - new AccountLoader(LoginActivity.this).call(); - } catch (IOException e) { - Log.d(TAG, "Exception loading organizations", e); - } - } else - accountManager.setPassword(account, password); + openLoginInBrowser(new GitHub(this)); + } - return user; - } + private void openLoginInBrowser(ApiClient client) { + String initialScope = "user,public_repo,repo,delete_repo,notifications,gist"; + final String url = String.format("%s?client_id=%s&scope=%s", + OAUTH_URL, client.getApiClient(), initialScope); - @Override - protected void onException(Exception e) throws RuntimeException { - dialog.dismiss(); + final List browserList = getBrowserList(); - Log.d(TAG, "Exception requesting authenticated user", e); - handleLoginException(e); - } + final List intentList = new ArrayList<>(); - @Override - public void onSuccess(User user) { - dialog.dismiss(); - - if (user != null) - onAuthenticationResult(true); - } - }; - authenticationTask.execute(); - } + for (final ResolveInfo resolveInfo : browserList) { + final Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + newIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, + resolveInfo.activityInfo.name)); - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - if (requestCode == OTP_CODE_ENTER) { - switch (resultCode) { - case RESULT_OK: - onAuthenticationResult(true); - break; - case RESULT_CANCELED: - Exception e = (Exception) data.getExtras().getSerializable(PARAM_EXCEPTION); - handleLoginException(e); - break; - } + intentList.add(new LabeledIntent(newIntent, + resolveInfo.resolvePackageName, + resolveInfo.labelRes, + resolveInfo.icon)); } - } - /** - * Called when response is received from the server for confirm credentials - * request. See onAuthenticationResult(). Sets the - * AccountAuthenticatorResult which is sent back to the caller. - * - * @param result - */ - protected void finishConfirmCredentials(boolean result) { - final Account account = new Account(username, ACCOUNT_TYPE); - accountManager.setPassword(account, password); - - final Intent intent = new Intent(); - intent.putExtra(KEY_BOOLEAN_RESULT, result); - setAccountAuthenticatorResult(intent.getExtras()); - setResult(RESULT_OK, intent); - finish(); - } + final Intent chooser = Intent.createChooser(intentList.remove(0), "Choose your favorite browser"); + LabeledIntent[] extraIntents = intentList.toArray( new LabeledIntent[ intentList.size() ]); + chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents); - /** - * Called when response is received from the server for authentication - * request. See onAuthenticationResult(). Sets the - * AccountAuthenticatorResult which is sent back to the caller. Also sets - * the authToken in AccountManager for this account. - * - * @param username - * @param password - */ - - protected void finishLogin(final String username, final String password) { - final Intent intent = new Intent(); - intent.putExtra(KEY_ACCOUNT_NAME, username); - intent.putExtra(KEY_ACCOUNT_TYPE, ACCOUNT_TYPE); - if (ACCOUNT_TYPE.equals(authTokenType)) - intent.putExtra(KEY_AUTHTOKEN, password); - setAccountAuthenticatorResult(intent.getExtras()); - setResult(RESULT_OK, intent); - finish(); + startActivity(chooser); } - /** - * Called when the authentication process completes (see attemptLogin()). - * - * @param result - */ - public void onAuthenticationResult(boolean result) { - if (result) { - if (!confirmCredentials) - finishLogin(username, password); - else - finishConfirmCredentials(true); - } else { - if (requestNewAccount) - ToastUtils.show(this, R.string.invalid_login_or_password); - else - ToastUtils.show(this, R.string.invalid_password); - } + private List getBrowserList() { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://sometesturl.com")); + + return getPackageManager().queryIntentActivities(intent, 0); } @Override @@ -446,37 +239,43 @@ public boolean onOptionsItemSelected(MenuItem item) { } @Override - public boolean onCreateOptionsMenu(Menu optionMenu) { - getMenuInflater().inflate(R.menu.login, optionMenu); - loginItem = optionMenu.findItem(R.id.m_login); - return true; - } + public void onResponseOk(com.alorma.github.sdk.bean.dto.response.User user, Response r) { + Account account = new Account(user.login, getString(R.string.account_type)); + Bundle userData = AccountsHelper.buildBundle(user.name, user.email, user.avatar_url, scope); + userData.putString(AccountManager.KEY_AUTHTOKEN, accessToken); - private List getEmailAddresses() { - final Account[] accounts = accountManager - .getAccountsByType("com.google"); - final List addresses = new ArrayList<>(accounts.length); - for (Account account : accounts) - addresses.add(account.name); - return addresses; + accountManager.addAccountExplicitly(account, null, userData); + accountManager.setAuthToken(account, getString(R.string.account_type), accessToken); + + Bundle result = new Bundle(); + result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); + result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type); + result.putString(AccountManager.KEY_AUTHTOKEN, accessToken); + + setAccountAuthenticatorResult(result); + + openMain(); } - private void sendSmsOtpCode(final OAuthService service) throws IOException { - try { - AccountAuthenticator.createAuthorization(service); - } catch (TwoFactorAuthException ignored) { - } + @Override + public void onFail(RetrofitError error) { + error.printStackTrace(); } - private void openTwoFactorAuthActivity() { - Intent intent = TwoFactorAuthActivity.createIntent(this, username, password); - startActivityForResult(intent, OTP_CODE_ENTER); + private void endAccess(String accessToken, String scope) { + this.accessToken = accessToken; + this.scope = scope; + + progressDialog.setMessage(getString(R.string.loading_user)); + + GetAuthUserClient userClient = new GetAuthUserClient(this, accessToken); + userClient.setOnResultCallback(this); + userClient.execute(); } - private void handleLoginException(final Exception e) { - if (AccountUtils.isUnauthorized(e)) - onAuthenticationResult(false); - else - ToastUtils.show(LoginActivity.this, e, R.string.code_authentication_failed); + @Override + public boolean onCreateOptionsMenu(Menu optionMenu) { + getMenuInflater().inflate(R.menu.login, optionMenu); + return true; } -} +} \ No newline at end of file diff --git a/app/src/main/res/layout/login.xml b/app/src/main/res/layout/login.xml index 200e87897..34ed6b4d8 100644 --- a/app/src/main/res/layout/login.xml +++ b/app/src/main/res/layout/login.xml @@ -20,73 +20,19 @@ android:orientation="vertical"> + android:background="?attr/colorPrimary" + android:id="@+id/toolbar" /> - - - - - - - - - - - - - - - - - - - + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:gravity="center_horizontal" + android:textColor="@color/primary_dark" + style="@style/TextAppearance.AppCompat.Subhead" + android:text="@string/temporary_login_message"/> + \ No newline at end of file diff --git a/app/src/main/res/menu/login.xml b/app/src/main/res/menu/login.xml index 8eaf258cf..10431cadc 100644 --- a/app/src/main/res/menu/login.xml +++ b/app/src/main/res/menu/login.xml @@ -19,7 +19,6 @@ diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml new file mode 100644 index 000000000..ba697a0c3 --- /dev/null +++ b/app/src/main/res/values/config.xml @@ -0,0 +1,14 @@ + + + com.github + + + + + + + + + //The thing before the "://..." in github_oauth, used for identifying the intent call + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index afb0b9dbf..58bbbdc1b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -107,6 +107,7 @@ Clear History Search history cleared Logging in… + Loading user profile… Creating Gist… Create Create Gist @@ -301,5 +302,6 @@ and comments, and remove all collaborator associations. Repository is deleted Login or Email + Authenticating is now done through the website, press the log in button to continue. diff --git a/app/src/main/res/xml/authenticator.xml b/app/src/main/res/xml/authenticator.xml index 5d240a3c9..b88f3ed45 100644 --- a/app/src/main/res/xml/authenticator.xml +++ b/app/src/main/res/xml/authenticator.xml @@ -15,7 +15,7 @@ limitations under the License. --> diff --git a/build.gradle b/build.gradle index 3ab7a44fb..1acd9436d 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,7 @@ allprojects { repositories { maven { url "http://dl.bintray.com/populov/maven" } maven { url "https://repo.eclipse.org/content/groups/releases" } + maven { url "http://dl.bintray.com/alorma/maven"} jcenter() } } From 17f19f4971207f2872895ffde63080c55e93bd47 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sun, 28 Jun 2015 08:40:21 +0200 Subject: [PATCH 0537/1055] Changed from string resource to BuildConfig (Add values to github.properties) --- .gitignore | 3 +++ app/build.gradle | 16 +++++++++++++++- .../github/mobile/accounts/LoginActivity.java | 15 +++++++++++---- app/src/main/res/values/config.xml | 10 ---------- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index eca7ba438..9ec56cba4 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ tmp/ # TeXlipse plugin .texlipse + +#GitHub application codes (local and personal) +github.properties \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index f2313ffa5..b6ab33596 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,6 +9,20 @@ android { targetSdkVersion 22 versionCode 1900 versionName '1.9.0' + + def Properties githubProps = new Properties() + githubProps.load(new FileInputStream(file('../github.properties'))) + + assert githubProps["GITHUB_SECRET"] + resValue "string", "github_secret", githubProps["GITHUB_SECRET"] + + assert githubProps["GITHUB_CLIENT"] + resValue "string", "github_client", githubProps["GITHUB_CLIENT"] + + assert githubProps["GITHUB_CALLBACK"] + def oauth = githubProps["GITHUB_CALLBACK"] + resValue "string", "github_oauth", oauth + resValue "string", "github_oauth_scheme", oauth.split("://")[0] } packagingOptions { @@ -33,7 +47,7 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.squareup.picasso:picasso:2.5.0' - compile 'com.squareup.okhttp:okhttp:2.3.0' + compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'org.roboguice:roboguice:2.0' compile 'com.github.kevinsawicki:http-request:5.6' compile 'com.google.code.gson:gson:2.3.1' diff --git a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java index 893382d92..a6aedf0e7 100644 --- a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java +++ b/app/src/main/java/com/github/mobile/accounts/LoginActivity.java @@ -49,6 +49,7 @@ import com.github.mobile.ui.MainActivity; import com.github.mobile.ui.roboactivities.RoboActionBarAccountAuthenticatorActivity; import com.google.inject.Inject; +import com.squareup.okhttp.HttpUrl; import java.util.ArrayList; import java.util.List; @@ -74,7 +75,7 @@ public class LoginActivity extends RoboActionBarAccountAuthenticatorActivity imp */ public static final String PARAM_USERNAME = "username"; - public static final String OAUTH_URL = "https://github.com/login/oauth/authorize"; + public static final String OAUTH_HOST = "www.github.com"; private static final String TAG = "LoginActivity"; @@ -195,15 +196,21 @@ public void handleLogin() { private void openLoginInBrowser(ApiClient client) { String initialScope = "user,public_repo,repo,delete_repo,notifications,gist"; - final String url = String.format("%s?client_id=%s&scope=%s", - OAUTH_URL, client.getApiClient(), initialScope); + HttpUrl.Builder url = new HttpUrl.Builder() + .scheme("https") + .host(OAUTH_HOST) + .addPathSegment("login") + .addPathSegment("oauth") + .addPathSegment("authorize") + .addQueryParameter("client_id", client.getApiClient()) + .addQueryParameter("scope", initialScope); final List browserList = getBrowserList(); final List intentList = new ArrayList<>(); for (final ResolveInfo resolveInfo : browserList) { - final Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + final Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url.build().toString())); newIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name)); diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml index ba697a0c3..9254e5569 100644 --- a/app/src/main/res/values/config.xml +++ b/app/src/main/res/values/config.xml @@ -1,14 +1,4 @@ com.github - - - - - - - - - //The thing before the "://..." in github_oauth, used for identifying the intent call - \ No newline at end of file From 6fee9008ab913f27b3da77b02c69e68b7a6bf61b Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 11 Jul 2015 14:20:36 +0200 Subject: [PATCH 0538/1055] Added log message if build value is not found Moved from browser to WebView for authentication Added disclaimer for third-party restrictions Updated two libs (It changes nothing) --- app/build.gradle | 35 ++++++---- app/src/main/AndroidManifest.xml | 2 + .../github/mobile/accounts/LoginActivity.java | 67 ++++++------------- .../mobile/accounts/LoginWebViewActivity.java | 36 ++++++++++ app/src/main/res/layout/login.xml | 4 +- app/src/main/res/values/strings.xml | 7 +- 6 files changed, 91 insertions(+), 60 deletions(-) create mode 100644 app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java diff --git a/app/build.gradle b/app/build.gradle index b6ab33596..03dd65a4a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion '22.0.1' + defaultConfig { applicationId 'com.github.mobile' minSdkVersion 15 @@ -11,18 +12,17 @@ android { versionName '1.9.0' def Properties githubProps = new Properties() - githubProps.load(new FileInputStream(file('../github.properties'))) - - assert githubProps["GITHUB_SECRET"] - resValue "string", "github_secret", githubProps["GITHUB_SECRET"] + if(file('../github.properties').exists()) { + githubProps.load(new FileInputStream(file('../github.properties'))) - assert githubProps["GITHUB_CLIENT"] - resValue "string", "github_client", githubProps["GITHUB_CLIENT"] + resValue "string", "github_secret", getValue(githubProps, "GITHUB_SECRET") + resValue "string", "github_client", getValue(githubProps, "GITHUB_CLIENT") - assert githubProps["GITHUB_CALLBACK"] - def oauth = githubProps["GITHUB_CALLBACK"] - resValue "string", "github_oauth", oauth - resValue "string", "github_oauth_scheme", oauth.split("://")[0] + def oauth = getValue(githubProps, "GITHUB_CALLBACK") + resValue "string", "github_oauth", oauth + resValue "string", "github_oauth_scheme", oauth != "DEFAULT" ? oauth.split("://")[0] : oauth + } else + logger.log(LogLevel.ERROR, "github.properties can not be found, please add it to the project root") } packagingOptions { @@ -43,16 +43,27 @@ repositories { } } +def getValue(def props, def name){ + if(props[name]) + return props[name] + else if(System.getenv(name)) + return System.getenv(name) + else { + logger.log(LogLevel.ERROR, name + " has not been provided, add it to your github.properties file") + return "DEFAULT" + } +} + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.0.0' + compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.squareup.picasso:picasso:2.5.0' compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'org.roboguice:roboguice:2.0' compile 'com.github.kevinsawicki:http-request:5.6' compile 'com.google.code.gson:gson:2.3.1' compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.7.0.201502260915-r' - compile 'com.android.support:support-v4:22.0.0' + compile 'com.android.support:support-v4:22.2.0' compile ('com.google.inject.extensions:guice-assistedinject:3.0'){ exclude group: 'com.google.inject' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 332e14507..1c344f94f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -346,6 +346,8 @@ + + () { @Override public void onResponseOk(Token token, Response r) { if (token.access_token != null) { - endAccess(token.access_token, token.scope); + endAuth(token.access_token, token.scope); } else if (token.error != null) { Toast.makeText(LoginActivity.this, token.error, Toast.LENGTH_LONG).show(); progressDialog.dismiss(); @@ -170,7 +169,8 @@ public void onFail(RetrofitError error) { } private void openMain() { - progressDialog.dismiss(); + if(progressDialog != null) + progressDialog.dismiss(); Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); @@ -182,14 +182,6 @@ private void openLoadingDialog() { progressDialog.show(); } - @Override - public void startActivity(Intent intent) { - if (intent != null && ACTION_VIEW.equals(intent.getAction())) - intent.addCategory(CATEGORY_BROWSABLE); - - super.startActivity(intent); - } - public void handleLogin() { openLoginInBrowser(new GitHub(this)); } @@ -205,32 +197,16 @@ private void openLoginInBrowser(ApiClient client) { .addQueryParameter("client_id", client.getApiClient()) .addQueryParameter("scope", initialScope); - final List browserList = getBrowserList(); - - final List intentList = new ArrayList<>(); - - for (final ResolveInfo resolveInfo : browserList) { - final Intent newIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url.build().toString())); - newIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, - resolveInfo.activityInfo.name)); - - intentList.add(new LabeledIntent(newIntent, - resolveInfo.resolvePackageName, - resolveInfo.labelRes, - resolveInfo.icon)); - } - - final Intent chooser = Intent.createChooser(intentList.remove(0), "Choose your favorite browser"); - LabeledIntent[] extraIntents = intentList.toArray( new LabeledIntent[ intentList.size() ]); - chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents); - - startActivity(chooser); + Intent intent = new Intent(this, LoginWebViewActivity.class); + intent.putExtra(INTENT_EXTRA_URL, url.toString()); + startActivityForResult(intent, WEBVIEW_REQUEST_CODE); } - private List getBrowserList() { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://sometesturl.com")); - - return getPackageManager().queryIntentActivities(intent, 0); + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if(requestCode == WEBVIEW_REQUEST_CODE && resultCode == RESULT_OK) + onUserLoggedIn(data.getData()); } @Override @@ -242,7 +218,6 @@ public boolean onOptionsItemSelected(MenuItem item) { default: return super.onOptionsItemSelected(item); } - } @Override @@ -269,7 +244,7 @@ public void onFail(RetrofitError error) { error.printStackTrace(); } - private void endAccess(String accessToken, String scope) { + private void endAuth(String accessToken, String scope) { this.accessToken = accessToken; this.scope = scope; diff --git a/app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java b/app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java new file mode 100644 index 000000000..ec37c98f1 --- /dev/null +++ b/app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java @@ -0,0 +1,36 @@ +package com.github.mobile.accounts; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.webkit.WebViewClient; + +import com.github.mobile.R; +import com.github.mobile.ui.WebView; + +public class LoginWebViewActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + WebView webView = new WebView(this); + webView.loadUrl(getIntent().getStringExtra(LoginActivity.INTENT_EXTRA_URL)); + webView.setWebViewClient(new WebViewClient() { + @Override + public boolean shouldOverrideUrlLoading(android.webkit.WebView view, String url) { + Uri uri = Uri.parse(url); + if (uri.getScheme().equals(getString(R.string.github_oauth_scheme))) { + Intent data = new Intent(); + data.setData(uri); + setResult(RESULT_OK, data); + finish(); + return true; + } + return super.shouldOverrideUrlLoading(view, url); + } + }); + + setContentView(webView); + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/login.xml b/app/src/main/res/layout/login.xml index 34ed6b4d8..f92600280 100644 --- a/app/src/main/res/layout/login.xml +++ b/app/src/main/res/layout/login.xml @@ -34,5 +34,7 @@ android:gravity="center_horizontal" android:textColor="@color/primary_dark" style="@style/TextAppearance.AppCompat.Subhead" - android:text="@string/temporary_login_message"/> + android:text="@string/temporary_login_message" + android:linksClickable="true" + android:autoLink="web"/> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 58bbbdc1b..4afe9492b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -302,6 +302,11 @@ and comments, and remove all collaborator associations. Repository is deleted Login or Email - Authenticating is now done through the website, press the log in button to continue. + + Authenticating is now done through the website, + press the log in button to continue. + \n\n Since GitHub has added third-party restrictions we are unable to write + to certain organizations. You can read more here:\n + https://help.github.com/articles/about-third-party-application-restrictions/ From 9caf6b5913db7c45d2b1efbf169f98aeae05a150 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 11 Jul 2015 15:43:59 +0200 Subject: [PATCH 0539/1055] Fixed merge fail... --- app/build.gradle | 5 ++--- build.gradle | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index aec3820af..e83304840 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -68,7 +68,7 @@ dependencies { exclude group: 'com.google.inject' } - compile 'com.github.alorma:github-sdk:1.0.1@aar' + compile 'com.github.alorma:github-sdk:1.0.1' compile 'com.viewpagerindicator:library:2.4.1@aar' compile 'com.squareup.okio:okio:1.1.0' compile 'com.squareup.retrofit:retrofit:1.9.0' @@ -82,5 +82,4 @@ dependencies { } compile 'com.android.support:design:22.2.0' -} -}} \ No newline at end of file +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1acd9436d..3ab7a44fb 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,6 @@ allprojects { repositories { maven { url "http://dl.bintray.com/populov/maven" } maven { url "https://repo.eclipse.org/content/groups/releases" } - maven { url "http://dl.bintray.com/alorma/maven"} jcenter() } } From e5b509aa8fbd006f38e0ca0ed401db20b609099b Mon Sep 17 00:00:00 2001 From: Henrik Date: Sat, 11 Jul 2015 16:23:55 +0200 Subject: [PATCH 0540/1055] Value were not added if github.properties was missing --- app/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e83304840..5c06f90a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,17 +12,17 @@ android { versionName '1.9.0' def Properties githubProps = new Properties() - if(file('../github.properties').exists()) { + if(file('../github.properties').exists()) githubProps.load(new FileInputStream(file('../github.properties'))) + else + logger.log(LogLevel.ERROR, "github.properties can not be found, please add it to the project root") resValue "string", "github_secret", getValue(githubProps, "GITHUB_SECRET") resValue "string", "github_client", getValue(githubProps, "GITHUB_CLIENT") def oauth = getValue(githubProps, "GITHUB_CALLBACK") resValue "string", "github_oauth", oauth - resValue "string", "github_oauth_scheme", oauth != "DEFAULT" ? oauth.split("://")[0] : oauth - } else - logger.log(LogLevel.ERROR, "github.properties can not be found, please add it to the project root") + resValue "string", "github_oauth_scheme", oauth != "DEFAULT" ? oauth.split("://")[0] : "DEFAULT" } packagingOptions { @@ -44,7 +44,7 @@ repositories { } def getValue(def props, def name){ - if(props[name]) + if(props && props[name]) return props[name] else if(System.getenv(name)) return System.getenv(name) From be28e75ec0fa15da22f538421663fd9bf329af37 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Sun, 12 Jul 2015 01:51:18 -0700 Subject: [PATCH 0541/1055] Fix tabs being fixed size --- app/src/main/res/layout/pager_with_tabs.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/layout/pager_with_tabs.xml b/app/src/main/res/layout/pager_with_tabs.xml index 146317c75..4821b9f92 100644 --- a/app/src/main/res/layout/pager_with_tabs.xml +++ b/app/src/main/res/layout/pager_with_tabs.xml @@ -40,6 +40,7 @@ android:layout_below="@id/toolbar" android:id="@+id/sliding_tabs_layout" app:tabIndicatorColor="@android:color/white" + app:tabMode="scrollable" android:background="@color/primary" android:layout_width="match_parent" android:layout_height="wrap_content" /> From ab1a627c974d687eb5ba5a9b5baae2486d744343 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Sun, 12 Jul 2015 02:16:51 -0700 Subject: [PATCH 0542/1055] Update README, remove CHANGELOG, and add CONTRIBUTING Changelog is tedious to keep up to date, easier to just use the releases tab of the repo and point people to that --- CHANGELOG.md | 31 ------------------------ CONTRIBUTING.md | 29 +++++++++++++++++++++++ README.md | 63 +++++++++++++++++++------------------------------ 3 files changed, 53 insertions(+), 70 deletions(-) delete mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 96d754b14..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,31 +0,0 @@ -# Change Log -All notable changes to this project will be documented in this file. -This project is meant to be a continuation of now discontinued GitHub Android v1.9.0 by GitHub - -## [Unreleased][unreleased] - -### Added -- Implement Material Design -- Fork a repo -- Delete a repo -- Copy commit's hash -- Fast-scroll during code view -- Include detail information in issues -- Base for API migration from Egit (using Retrofit) - -### Updated -- Use Gradle as the main build tool instead of Maven -- GitHub's link handling -- Translations -- Code highlighting (C/C++ header, Scala/Sbt) - -### Fixed -- Issue dashboard can't be seen by project maintainer -- Frequent crashes due to memory leak in image loading -- Duplicated issues when searching -- Garbled Chinese characters in markdown - -## [1.9.0] - 2014-02-21 - -[unreleased]: https://github.com/forkhubs/android/compare/1.9.0...HEAD -[1.9.0]: https://github.com/forkhubs/android/releases/tag/1.9.0 \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..d5703fd86 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,29 @@ +Contributing +============ + +## ALL pull requests + +Please include a descriptive title and description. If you changed anything with the UI, please include screenshots of how +it looks. Use descriptive messages for your commits, and be sure to explain the *why* for commits where appropriate. + +Please **don't** squash all your commits into one before opening the PR. Commits are easier to review when they're split up and in the +order they happened. Of course, do squash smaller commits together as needed to ensure a clean history. + +If you open a pull request, you are responsible for engaging with us in the review and discussion afterward. If you don't respond +to comments after opening, we will probably just close it. + +## Translations + +Always welcome, but please be prepared to have someone else that speaks if available to review it. Chances are that we cannot +review it ourselves, for obvious reasons. + +## Bugfixes for existing issues + +Always welcome. Please reference the issue number you're addressing in the PR, and let us know in the issue tracker if +you're working on it. + +## New features, UI changes, and infrastructure changes + +Please make sure you discuss these with us in the issue tracker before opening a pull request. It's good to get a conversation +going first to make sure that everyone is on the same page, and this way you don't accidentally invest a lot of time into +something we don't want to merge. That said, we're always open to these, so please don't hesitate to start the discussion! \ No newline at end of file diff --git a/README.md b/README.md index 7dbcceda4..90651842b 100644 --- a/README.md +++ b/README.md @@ -2,55 +2,40 @@ This repository contains the source code for the GitHub Android app. -[![Download from Google Play](https://cloud.githubusercontent.com/assets/3838734/3855877/4cf2a2dc-1eec-11e4-9634-2a1adf8f1c39.jpg)](https://play.google.com/store/apps/details?id=com.github.mobile) +## What's going on here? +> What happened to the old app? -Please see the [issues](https://github.com/forkhubs/android/issues) section to -report any bugs or feature requests and to see the list of known issues. +GitHub didn't want to maintain the app anymore, so it's been released to the community and maintained as a public project. +We are actively working towards a re-release to the Play Store, and this app will be the spiritual successor to the original +GitHub app. -## License - -* [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) - -## Building - -### With Gradle - -The easiest way to build is to install [Android Studio](https://developer.android.com/sdk/index.html) v1.+. -Once installed, then you can import the project into Android Studio: +> What about the other forks out there? -1. Open `File` -2. Import Project -3. Select `build.gradle` under the project directory -4. Click `OK` +They'll remain forks. Obviously we'd prefer them to focus on improving this project, but otherwise we're not in coordinating +anything with them. -Then, Gradle will do everything for you. +> What's the immediate plan? -You might find that your device doesn't let you install your build if you -already have the version from Google Play installed. This is standard -Android security as it it won't let you directly replace an app that's been -signed with a different key. Manually uninstall GitHub from your device and -you will then be able to install your own built version. +We're shooting for an initial re-release just to get the app out there. There have been a significant number of changes +since the app was last updated, with many functional and design changes that we need to make sure are good to go. -## Acknowledgements +> What's the less-immediate plan? -This project uses the [GitHub Java API](https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core) -built on top of [API v3](http://developer.github.com/). +After the initial release, we'll start working on giving this app a proper refresh. Much of the UI has already been touched +up with elements of Material Design, but we have a long ways to go. Android has changed a lot since this was actively developed, +and it's time we take advantage of those changes. -It also uses many other open source libraries such as: +> How can I help? -* [CodeMirror](https://github.com/codemirror/CodeMirror) -* [RoboGuice](https://github.com/roboguice/roboguice) -* [ViewPagerIndicator](https://github.com/JakeWharton/Android-ViewPagerIndicator) - -These are just a few of the major dependencies, the entire list of dependencies -is listed in the [app's build.gradle file](https://github.com/forkhubs/android/blob/master/app/build.gradle). +Please see the [issues](https://github.com/forkhubs/android/issues) section to report any bugs or feature requests and +to see the list of known issues. We can't promise fast response times since we all have full time jobs of our own, but we +will do our best to respond in a timely fashion. If you'd like to contribute, please fork this repository and contribute back using +[pull requests](https://github.com/forkhubs/android/pulls). -## Contributing +Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests +are welcomed and appreciated but will be thoroughly reviewed and discussed. **Please read `CONTRIBUTING.md` first!** -Please fork this repository and contribute back using -[pull requests](https://github.com/forkhubs/android/pulls). +## License -Any contributions, large or small, major features, bug fixes, additional -language translations, unit/integration tests are welcomed and appreciated -but will be thoroughly reviewed and discussed. +* [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) \ No newline at end of file From c53eeabd2d3f5e7e6482afd55eca04f883c87033 Mon Sep 17 00:00:00 2001 From: Henrik Date: Sun, 12 Jul 2015 19:56:54 +0200 Subject: [PATCH 0543/1055] Temp fix for weird AppLayout bug --- .../ui/PatchedScrollingViewBehavior.java | 59 +++++++++++++++++++ app/src/main/res/layout/pager_with_tabs.xml | 3 +- 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/github/mobile/ui/PatchedScrollingViewBehavior.java diff --git a/app/src/main/java/com/github/mobile/ui/PatchedScrollingViewBehavior.java b/app/src/main/java/com/github/mobile/ui/PatchedScrollingViewBehavior.java new file mode 100644 index 000000000..25e8e0588 --- /dev/null +++ b/app/src/main/java/com/github/mobile/ui/PatchedScrollingViewBehavior.java @@ -0,0 +1,59 @@ +package com.github.mobile.ui; + +import android.content.Context; +import android.support.design.widget.AppBarLayout; +import android.support.design.widget.CoordinatorLayout; +import android.support.v4.view.ViewCompat; +import android.util.AttributeSet; +import android.util.Log; +import android.view.View; + +import java.util.List; + +public class PatchedScrollingViewBehavior extends AppBarLayout.ScrollingViewBehavior { + + public PatchedScrollingViewBehavior() { + super(); + } + + public PatchedScrollingViewBehavior(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public boolean onMeasureChild(CoordinatorLayout parent, View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed) { + if(child.getLayoutParams().height == -1) { + List dependencies = parent.getDependencies(child); + if(dependencies.isEmpty()) + return false; + + AppBarLayout appBar = findFirstAppBarLayout(dependencies); + if(appBar != null && ViewCompat.isLaidOut(appBar)) { + if(ViewCompat.getFitsSystemWindows(appBar)) + ViewCompat.setFitsSystemWindows(child, true); + + int parentHeight = View.MeasureSpec.getSize(parentHeightMeasureSpec); + int height = parentHeight - appBar.getMeasuredHeight(); + int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY); + parent.onMeasureChild(child, parentWidthMeasureSpec, widthUsed, heightMeasureSpec, heightUsed); + return true; + } + } + + return false; + } + + + private static AppBarLayout findFirstAppBarLayout(List views) { + int i = 0; + + for(int z = views.size(); i < z; ++i) { + View view = views.get(i); + if(view instanceof AppBarLayout) { + return (AppBarLayout)view; + } + } + + return null; + } +} diff --git a/app/src/main/res/layout/pager_with_tabs.xml b/app/src/main/res/layout/pager_with_tabs.xml index 4821b9f92..90f1e9f3a 100644 --- a/app/src/main/res/layout/pager_with_tabs.xml +++ b/app/src/main/res/layout/pager_with_tabs.xml @@ -49,8 +49,7 @@ From 6e92590c5b6c837b29148423d7254b9e00443282 Mon Sep 17 00:00:00 2001 From: Sigee Date: Mon, 13 Jul 2015 09:41:25 +0200 Subject: [PATCH 0544/1055] FIX a typo. --- app/src/main/res/values-hu/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index c0c4dc785..6011e30c1 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -216,7 +216,7 @@ Sortörés engedélyezése Sortörés tiltása Főoldal - Felhasynálónév vagy E-mail cím + Felhasználónév vagy e-mail cím Hírek Tárolók Felhasználók From 51a2a67e47fac0ef196cac49982086d157b77e94 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Sat, 25 Jul 2015 15:23:51 -0700 Subject: [PATCH 0545/1055] Update CONTRIBUTING.md --- CONTRIBUTING.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d5703fd86..1565f5238 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,12 @@ Contributing ============ +## Reporting issues + +* Make sure there's not already an issue (open or closed) regarding your issue. +* Include detailed information and steps to reproduce. Any issues opened with no description will be ignored. +* Include a screenshot(s) of the issue. Brownie points for a screen recording of the issue. + ## ALL pull requests Please include a descriptive title and description. If you changed anything with the UI, please include screenshots of how From 735ac8c79e08eb6d336ef49ca8fad5f7e8f6b728 Mon Sep 17 00:00:00 2001 From: <> Date: Mon, 27 Jul 2015 09:00:59 +0200 Subject: [PATCH 0546/1055] Added installation to README --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 90651842b..0ec1000d0 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,19 @@ will do our best to respond in a timely fashion. If you'd like to contribute, p Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed. **Please read `CONTRIBUTING.md` first!** +## Install + +1. Create a github application (https://github.com/settings/applications/new) +2. Create a github.properties in the root folder of the repo +3. Add these three value too the github.properties + +``` +GITHUB_CLIENT=your_application_client_id +GITHUB_SECRET=your_application_client_secret +GITHUB_CALLBACK=your_callback_url +``` +(The callback url needs to be in the format "your_schema://whatever_you_want") + ## License * [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) \ No newline at end of file From 1dd5fa5d55770c8de44e5de28c26a47023715077 Mon Sep 17 00:00:00 2001 From: fadils Date: Mon, 27 Jul 2015 15:17:13 +0700 Subject: [PATCH 0547/1055] Update Travis badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90651842b..01028c81c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GitHub Android App [![Build Status](https://travis-ci.org/forkhubs/android.svg?branch=master)](https://travis-ci.org/forkhubs/android) +# GitHub Android App [![Build Status](https://travis-ci.org/pockethub/PocketHub.svg?branch=master)](https://travis-ci.org/pockethub/PocketHub) This repository contains the source code for the GitHub Android app. From da406be69faff6ddfb9ad346694eeedd13d2f307 Mon Sep 17 00:00:00 2001 From: Henrik Olsson Date: Mon, 27 Jul 2015 14:29:37 +0200 Subject: [PATCH 0548/1055] Changed title --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ec1000d0..2db847620 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ will do our best to respond in a timely fashion. If you'd like to contribute, p Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed. **Please read `CONTRIBUTING.md` first!** -## Install +## Setup Environment 1. Create a github application (https://github.com/settings/applications/new) 2. Create a github.properties in the root folder of the repo @@ -51,4 +51,4 @@ GITHUB_CALLBACK=your_callback_url ## License -* [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) \ No newline at end of file +* [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) From a58ff8c559a316eed3cf5df45cc304dab3986d97 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Mon, 27 Jul 2015 21:59:32 -0700 Subject: [PATCH 0549/1055] README updates --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d13e89096..6e8b70268 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# GitHub Android App [![Build Status](https://travis-ci.org/pockethub/PocketHub.svg?branch=master)](https://travis-ci.org/pockethub/PocketHub) +# PocketHub [![Build Status](https://travis-ci.org/pockethub/PocketHub.svg?branch=master)](https://travis-ci.org/pockethub/PocketHub) -This repository contains the source code for the GitHub Android app. +This repository contains the source code for the PocketHub Android app. + +This is the *same* repository as the now-defunct official GitHub Android app. ## What's going on here? @@ -28,10 +30,10 @@ and it's time we take advantage of those changes. > How can I help? -Please see the [issues](https://github.com/forkhubs/android/issues) section to report any bugs or feature requests and +Please see the [issues](https://github.com/pockethub/PocketHub/issues) section to report any bugs or feature requests and to see the list of known issues. We can't promise fast response times since we all have full time jobs of our own, but we will do our best to respond in a timely fashion. If you'd like to contribute, please fork this repository and contribute back using -[pull requests](https://github.com/forkhubs/android/pulls). +[pull requests](https://github.com/pockethub/PocketHub/pulls). Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed. **Please read `CONTRIBUTING.md` first!** From 0623791fbcace1cef6c0d8be429e261732b5ebfc Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Mon, 27 Jul 2015 22:07:28 -0700 Subject: [PATCH 0550/1055] Update to gradle 2.5 and android gradle plugin 1.2.3 --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 3ab7a44fb..3ffd7bc36 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.1.3' + classpath 'com.android.tools.build:gradle:1.2.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6ec673bc6..bb7087e18 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip From 441ba0ad1662777ef1b707ccae0baf586f2f2383 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Mon, 27 Jul 2015 22:07:46 -0700 Subject: [PATCH 0551/1055] Remove old test We no longer have a normal login activity anymore --- .../mobile/tests/user/LoginActivityTest.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/app/src/androidTest/java/com/github/mobile/tests/user/LoginActivityTest.java b/app/src/androidTest/java/com/github/mobile/tests/user/LoginActivityTest.java index 8df1fbdcc..9a87cdcc3 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/user/LoginActivityTest.java +++ b/app/src/androidTest/java/com/github/mobile/tests/user/LoginActivityTest.java @@ -16,10 +16,7 @@ package com.github.mobile.tests.user; import android.accounts.AccountManager; -import android.view.View; -import android.widget.EditText; -import com.github.mobile.R.id; import com.github.mobile.accounts.AccountUtils; import com.github.mobile.accounts.LoginActivity; import com.github.mobile.tests.ActivityTest; @@ -44,23 +41,4 @@ public void testHasAuthenticator() { .get(getActivity()))); } - /** - * Verify activity was created successfully - * - * @throws Throwable - */ - public void testSignInIsDisabled() throws Throwable { - View loginMenu = view(id.m_login); - assertFalse(loginMenu.isEnabled()); - final EditText login = editText(id.et_login); - final EditText password = editText(id.et_password); - focus(login); - send("loginname"); - assertEquals("loginname", login.getText().toString()); - assertFalse(loginMenu.isEnabled()); - focus(password); - send("password"); - assertEquals("password", password.getText().toString()); - assertTrue(loginMenu.isEnabled()); - } } From 890ad5236848e6801833457503bd46841d7d9e27 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Wed, 29 Jul 2015 05:05:38 +0200 Subject: [PATCH 0552/1055] update .travis.yml --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b46a83e8a..edc8385d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,7 @@ jdk: oraclejdk7 notifications: email: false -before_install: - - sudo apt-get update -qq - - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi +sudo: false script: - ./gradlew clean build From 82058be38399c271cf011a4a3c9a3fd5041beba9 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Wed, 5 Aug 2015 00:51:59 +0200 Subject: [PATCH 0553/1055] Set the App name to PocketHub --- app/src/main/res/values-bg/strings.xml | 1 - app/src/main/res/values-cs/strings.xml | 1 - app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-el/strings.xml | 1 - app/src/main/res/values-es/strings.xml | 1 - app/src/main/res/values-fr/strings.xml | 1 - app/src/main/res/values-hu/strings.xml | 1 - app/src/main/res/values-is/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 1 - app/src/main/res/values-ja/strings.xml | 1 - app/src/main/res/values-ko/strings.xml | 1 - app/src/main/res/values-no/strings.xml | 1 - app/src/main/res/values-pl/strings.xml | 1 - app/src/main/res/values-pt/strings.xml | 1 - app/src/main/res/values-ro/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values-sk/strings.xml | 1 - app/src/main/res/values-sv/strings.xml | 1 - app/src/main/res/values-tr/strings.xml | 1 - app/src/main/res/values-uk/strings.xml | 1 - app/src/main/res/values-zh-rCN/strings.xml | 1 - app/src/main/res/values-zh-rTW/strings.xml | 1 - app/src/main/res/values/strings.xml | 2 +- 23 files changed, 1 insertion(+), 23 deletions(-) diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index f222fa30d..57da0e328 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -83,7 +83,6 @@ Обновяване на етапа… - GitHub Новини Задания Gists diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 9ba334519..3316a1018 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -93,7 +93,6 @@ limitations under the License. Aktualizace milníku… - GitHub Novinky Návrhy Gisty diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 71183d80d..148db749b 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -94,7 +94,6 @@ Aktualisiere Meilensteine… - GitHub Home Neuigkeiten Tickets diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index e94a557ce..772e752dd 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -93,7 +93,6 @@ Ενημέρωση Οροσήμου… - GitHub Νέα Ζητήματα Gists diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 49ee1e5a7..a8ab03fd7 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -92,7 +92,6 @@ Actualizando hitos… - GitHub Noticias Incidencias Gists diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index fb8f70d6c..98100a546 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -93,7 +93,6 @@ Mise à jour du jalon… - GitHub Nouvelles Tickets Gists diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 6011e30c1..5b8f6bd1b 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -80,7 +80,6 @@ Mérföldkő frissítése… - GitHub Újdonságok Hibajegyek Gist-ek diff --git a/app/src/main/res/values-is/strings.xml b/app/src/main/res/values-is/strings.xml index 92d529f83..d2d4e5092 100644 --- a/app/src/main/res/values-is/strings.xml +++ b/app/src/main/res/values-is/strings.xml @@ -93,7 +93,6 @@ Uppfærir útgáfur… - GitHub Fréttir Vandamál Gists diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 8ba9b6766..b7fcbb6d5 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -96,7 +96,6 @@ Aggiornamento Milestone… - GitHub News Segnalazioni Gists diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 273d383cc..e7fbff7a1 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -93,7 +93,6 @@ マイルストーンを更新しています… - GitHub ニュース 課題 Gists diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 5ed9eea3b..e9d1ec0bb 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -74,7 +74,6 @@ 마일스톤 갱신중… - GitHub 소식 이슈 Gists diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index 6fbe4b301..28ea0d45d 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -93,7 +93,6 @@ Oppdaterer milepæl… - GitHub Nyheter Saker Gister diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 89c78c4bc..8f5c2abcd 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -93,7 +93,6 @@ Aktualizowanie kamieni milowych… - GitHub Aktualności Uwagi Gisty diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 5bba2ea7a..8b1b2e450 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -92,7 +92,6 @@ Atualizando Milestone… - GitHub Notícias Incidentes Gists diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 9674277cf..4156a1fb5 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -94,7 +94,6 @@ Actualizare bornă… - GitHub Acasă Noutăți Probleme diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 564340791..ffcddbb83 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -93,7 +93,6 @@ Обновляем цель… - GitHub Новости Задачи Gists diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 1dbf47956..a7f4202fb 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -94,7 +94,6 @@ Aktualizujem míľnik… - GitHub Novinky Issues Gisty diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 0ee5b12d0..252c994c6 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -93,7 +93,6 @@ Uppdaterar milstolpar… - GitHub Nyheter Frågor Gists diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 759eb1dac..da03cd155 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -94,7 +94,6 @@ Dönüm noktası güncelleniyor… - GitHub Ana sayfa Haberler Sorunlar diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 3e7f3fa3c..f987b62ec 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -90,7 +90,6 @@ Оновлення етапу… - GitHub Новини Задачі Gists diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index fe020a00b..9dcf621dc 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -93,7 +93,6 @@ 里程碑信息更新中… - GitHub 新鲜事 Issues Gists diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 2a214af3f..a35b172d5 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -75,7 +75,6 @@ 正在更新標籤… 正在更新里程碑… - GitHub 新聞 Issues Gists diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4afe9492b..204b0798b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -94,7 +94,7 @@ Updating Milestone… - GitHub + PocketHub Home News Issues From afda541e3e4b2e086662066d48628c0ac86f2f58 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Wed, 5 Aug 2015 00:30:14 -0700 Subject: [PATCH 0554/1055] Update support libraries and android gradle plugin to latest --- app/build.gradle | 6 +++--- build.gradle | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a89ec9805..f7e9378c6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -56,14 +56,14 @@ def getValue(def props, def name){ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.2.0' + compile 'com.android.support:appcompat-v7:22.2.1' compile 'com.squareup.picasso:picasso:2.5.0' compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'org.roboguice:roboguice:2.0' compile 'com.github.kevinsawicki:http-request:5.6' compile 'com.google.code.gson:gson:2.3.1' compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.7.0.201502260915-r' - compile 'com.android.support:support-v4:22.2.0' + compile 'com.android.support:support-v4:22.2.1' compile ('com.google.inject.extensions:guice-assistedinject:3.0'){ exclude group: 'com.google.inject' } @@ -82,5 +82,5 @@ dependencies { exclude group: 'org.apache.httpcomponents', module: 'httpclient' } - compile 'com.android.support:design:22.2.0' + compile 'com.android.support:design:22.2.1' } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3ffd7bc36..3c22d3d2e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:1.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From c97659888126e43e95f0d52d22188bfe194a8439 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Wed, 5 Aug 2015 00:34:39 -0700 Subject: [PATCH 0555/1055] Switch to new package name and applicationId --- app/build.gradle | 2 +- app/src/androidTest/AndroidManifest.xml | 2 +- .../tests/ActivityTest.java | 2 +- .../tests/FiltersViewActivityTest.java | 4 +- .../tests/NewsEventTextTest.java | 8 +- .../tests/commit/CommitUriMatcherTest.java | 6 +- .../tests/commit/CommitUtilsTest.java | 4 +- .../commit/CreateCommentActivityTest.java | 8 +- .../tests/commit/DiffStylerTest.java | 4 +- .../tests/commit/FullCommitTest.java | 4 +- .../tests/gist/CreateCommentActivityTest.java | 8 +- .../tests/gist/CreateGistActivityTest.java | 8 +- .../tests/gist/GistFilesViewActivityTest.java | 10 +-- .../tests/gist/GistStoreTest.java | 4 +- .../tests/gist/GistUriMatcherTest.java | 4 +- .../issue/CreateCommentActivityTest.java | 8 +- .../tests/issue/EditIssueActivityTest.java | 8 +- .../issue/EditIssuesFilterActivityTest.java | 8 +- .../tests/issue/IssueFilterTest.java | 4 +- .../tests/issue/IssueStoreTest.java | 4 +- .../tests/issue/IssueUriMatcherTest.java | 4 +- .../tests/ref/RefUtilsTest.java | 4 +- .../tests/repo/RecentRepositoriesTest.java | 6 +- .../repo/RepositoryEventMatcherTest.java | 4 +- .../tests/repo/RepositoryUriMatcherTest.java | 4 +- .../tests/repo/SearchActivityTest.java | 6 +- .../tests/user/LoginActivityTest.java | 8 +- .../tests/user/UserComparatorTest.java | 6 +- .../tests/user/UserUriMatcherTest.java | 4 +- .../tests/util/HtmlUtilsTest.java | 4 +- app/src/main/AndroidManifest.xml | 66 +++++++-------- .../{mobile => pockethub}/DefaultClient.java | 2 +- .../{mobile => pockethub}/GitHubModule.java | 18 ++--- .../github/{mobile => pockethub}/Intents.java | 2 +- .../{mobile => pockethub}/RequestCodes.java | 2 +- .../{mobile => pockethub}/RequestFuture.java | 2 +- .../{mobile => pockethub}/RequestReader.java | 2 +- .../{mobile => pockethub}/RequestWriter.java | 2 +- .../{mobile => pockethub}/ResultCodes.java | 2 +- .../{mobile => pockethub}/ServicesModule.java | 4 +- .../ThrowableLoader.java | 6 +- .../accounts/AccountAuthenticator.java | 14 ++-- .../accounts/AccountAuthenticatorService.java | 2 +- .../accounts/AccountClient.java | 4 +- .../accounts/AccountConstants.java | 2 +- .../accounts/AccountScope.java | 2 +- .../accounts/AccountUtils.java | 8 +- .../accounts/AuthenticatedUserLoader.java | 2 +- .../accounts/AuthenticatedUserTask.java | 2 +- .../accounts/GitHubAccount.java | 4 +- .../accounts/LoginActivity.java | 14 ++-- .../accounts/LoginWebViewActivity.java | 6 +- .../accounts/ScopeBase.java | 2 +- .../accounts/TwoFactorAuthActivity.java | 14 ++-- .../accounts/TwoFactorAuthClient.java | 4 +- .../accounts/TwoFactorAuthException.java | 2 +- .../api/GitHubClientV2.java | 4 +- .../{mobile => pockethub}/core/ItemStore.java | 2 +- .../core/OnLoadListener.java | 2 +- .../core/ResourcePager.java | 2 +- .../core/UrlMatcher.java | 2 +- .../core/code/FullTree.java | 6 +- .../core/code/RefreshBlobTask.java | 4 +- .../core/code/RefreshTreeTask.java | 6 +- .../core/commit/CommitCompareTask.java | 4 +- .../core/commit/CommitMatch.java | 2 +- .../core/commit/CommitPager.java | 4 +- .../core/commit/CommitStore.java | 4 +- .../core/commit/CommitUriMatcher.java | 4 +- .../core/commit/CommitUtils.java | 6 +- .../core/commit/FullCommit.java | 2 +- .../core/commit/FullCommitFile.java | 2 +- .../core/commit/RefreshCommitTask.java | 8 +- .../core/gist/FullGist.java | 2 +- .../core/gist/GistEventMatcher.java | 2 +- .../core/gist/GistPager.java | 4 +- .../core/gist/GistStore.java | 4 +- .../core/gist/GistUriMatcher.java | 2 +- .../core/gist/RefreshGistTask.java | 8 +- .../core/gist/StarGistTask.java | 4 +- .../core/gist/UnstarGistTask.java | 4 +- .../core/issue/FullIssue.java | 2 +- .../core/issue/IssueEventMatcher.java | 2 +- .../core/issue/IssueFilter.java | 2 +- .../core/issue/IssuePager.java | 4 +- .../core/issue/IssueStore.java | 6 +- .../core/issue/IssueUriMatcher.java | 4 +- .../core/issue/IssueUtils.java | 2 +- .../core/issue/RefreshIssueTask.java | 8 +- .../core/ref/RefUtils.java | 2 +- .../core/repo/DeleteRepositoryTask.java | 13 ++- .../core/repo/ForkRepositoryTask.java | 6 +- .../core/repo/RefreshRepositoryTask.java | 4 +- .../core/repo/RepositoryEventMatcher.java | 2 +- .../core/repo/RepositoryUriMatcher.java | 2 +- .../core/repo/RepositoryUtils.java | 2 +- .../core/repo/StarRepositoryTask.java | 6 +- .../core/repo/StarredRepositoryTask.java | 4 +- .../core/repo/UnstarRepositoryTask.java | 6 +- .../core/search/SearchUser.java | 2 +- .../core/search/SearchUserService.java | 2 +- .../core/user/FollowUserTask.java | 6 +- .../core/user/FollowingUserTask.java | 4 +- .../core/user/RefreshUserTask.java | 4 +- .../core/user/UnfollowUserTask.java | 6 +- .../core/user/UserComparator.java | 4 +- .../core/user/UserEventMatcher.java | 2 +- .../core/user/UserPager.java | 4 +- .../core/user/UserUriMatcher.java | 4 +- .../{mobile => pockethub}/model/App.java | 2 +- .../model/Authorization.java | 2 +- .../persistence/AccountDataManager.java | 14 ++-- .../persistence/CacheHelper.java | 2 +- .../persistence/DatabaseCache.java | 2 +- .../persistence/OrganizationRepositories.java | 4 +- .../persistence/Organizations.java | 2 +- .../persistence/PersistableResource.java | 2 +- .../sync/ContentProviderAdapter.java | 2 +- .../sync/SyncAdapter.java | 6 +- .../sync/SyncAdapterService.java | 2 +- .../sync/SyncCampaign.java | 8 +- .../ui/BaseActivity.java | 4 +- .../ui/CheckableRelativeLayout.java | 2 +- .../ui/ConfirmDialogFragment.java | 2 +- .../ui/DialogFragment.java | 4 +- .../ui/DialogFragmentActivity.java | 4 +- .../ui/DialogFragmentHelper.java | 2 +- .../ui/DialogResultListener.java | 2 +- .../ui/FragmentPagerAdapter.java | 2 +- .../ui/FragmentProvider.java | 2 +- .../ui/FragmentStatePagerAdapter.java | 2 +- .../ui/HeaderFooterListAdapter.java | 2 +- .../ui/ItemListFragment.java | 8 +- .../ui/LightAlertDialog.java | 2 +- .../ui/LightProgressDialog.java | 4 +- .../ui/MainActivity.java | 24 +++--- .../ui/MarkdownLoader.java | 6 +- .../ui/NavigationDrawerAdapter.java | 14 ++-- .../ui/NavigationDrawerFragment.java | 6 +- .../ui/NavigationDrawerObject.java | 2 +- .../ui/NewsFragment.java | 28 +++---- .../ui/PagedItemFragment.java | 6 +- .../ui/PagerActivity.java | 2 +- .../ui/PagerFragment.java | 2 +- .../ui/PatchedScrollingViewBehavior.java | 3 +- .../ui/ProgressDialogTask.java | 4 +- .../ui/ResourceLoadingIndicator.java | 4 +- .../ui/SelectableLinkMovementMethod.java | 2 +- .../ui/SingleChoiceDialogFragment.java | 2 +- .../{mobile => pockethub}/ui/StyledText.java | 4 +- .../ui/TabPagerActivity.java | 4 +- .../ui/TabPagerFragment.java | 4 +- .../ui/TextWatcherAdapter.java | 2 +- .../{mobile => pockethub}/ui/ViewPager.java | 2 +- .../{mobile => pockethub}/ui/WebView.java | 2 +- .../ui/code/RepositoryCodeFragment.java | 38 ++++----- .../ui/comment/CommentListAdapter.java | 12 +-- .../comment/CommentPreviewPagerAdapter.java | 6 +- .../ui/comment/CreateCommentActivity.java | 14 ++-- .../ui/comment/DeleteCommentListener.java | 2 +- .../ui/comment/EditCommentListener.java | 2 +- .../ui/comment/RawCommentFragment.java | 8 +- .../ui/comment/RenderedCommentFragment.java | 12 +-- .../ui/commit/CommitCompareListFragment.java | 22 ++--- .../ui/commit/CommitCompareViewActivity.java | 18 ++--- .../ui/commit/CommitDiffListFragment.java | 38 ++++----- .../ui/commit/CommitFileComparator.java | 2 +- .../ui/commit/CommitFileListAdapter.java | 14 ++-- .../ui/commit/CommitFileViewActivity.java | 42 +++++----- .../ui/commit/CommitListAdapter.java | 12 +-- .../ui/commit/CommitListFragment.java | 36 ++++----- .../ui/commit/CommitPagerAdapter.java | 8 +- .../ui/commit/CommitViewActivity.java | 24 +++--- .../ui/commit/CreateCommentActivity.java | 20 ++--- .../ui/commit/CreateCommentTask.java | 10 +-- .../ui/commit/DiffStyler.java | 4 +- .../ui/gist/CreateCommentActivity.java | 10 +-- .../ui/gist/CreateCommentTask.java | 10 +-- .../ui/gist/CreateGistActivity.java | 12 +-- .../ui/gist/CreateGistTask.java | 8 +- .../ui/gist/DeleteCommentTask.java | 8 +- .../ui/gist/DeleteGistTask.java | 8 +- .../ui/gist/EditCommentActivity.java | 14 ++-- .../ui/gist/EditCommentTask.java | 10 +-- .../ui/gist/GistFileFragment.java | 22 ++--- .../ui/gist/GistFilesPagerAdapter.java | 6 +- .../ui/gist/GistFilesViewActivity.java | 26 +++--- .../ui/gist/GistFragment.java | 53 ++++++------ .../ui/gist/GistListAdapter.java | 10 +-- .../ui/gist/GistQueriesPagerAdapter.java | 6 +- .../ui/gist/GistsFragment.java | 14 ++-- .../ui/gist/GistsPagerAdapter.java | 6 +- .../ui/gist/GistsPagerFragment.java | 12 +-- .../ui/gist/GistsViewActivity.java | 32 ++++---- .../ui/gist/MyGistsFragment.java | 12 +-- .../ui/gist/PublicGistsFragment.java | 6 +- .../ui/gist/RandomGistTask.java | 12 +-- .../ui/gist/StarredGistsFragment.java | 6 +- .../ui/issue/AssigneeDialog.java | 10 +-- .../ui/issue/AssigneeDialogFragment.java | 10 +-- .../ui/issue/CreateCommentActivity.java | 18 ++--- .../ui/issue/CreateCommentTask.java | 10 +-- .../ui/issue/CreateIssueTask.java | 10 +-- .../ui/issue/DashboardIssueFragment.java | 14 ++-- .../ui/issue/DashboardIssueListAdapter.java | 10 +-- .../ui/issue/DeleteCommentTask.java | 8 +- .../ui/issue/EditAssigneeTask.java | 12 +-- .../ui/issue/EditCommentActivity.java | 20 ++--- .../ui/issue/EditCommentTask.java | 10 +-- .../ui/issue/EditIssueActivity.java | 34 ++++---- .../ui/issue/EditIssueTask.java | 10 +-- .../ui/issue/EditIssuesFilterActivity.java | 14 ++-- .../ui/issue/EditLabelsTask.java | 12 +-- .../ui/issue/EditMilestoneTask.java | 12 +-- .../ui/issue/EditStateTask.java | 16 ++-- .../ui/issue/FilterListAdapter.java | 8 +- .../ui/issue/FilterListFragment.java | 12 +-- .../ui/issue/FiltersViewActivity.java | 19 +++-- .../ui/issue/FiltersViewFragment.java | 20 ++--- .../ui/issue/IssueBrowseActivity.java | 16 ++-- .../ui/issue/IssueDashboardPagerAdapter.java | 8 +- .../ui/issue/IssueDashboardPagerFragment.java | 14 ++-- .../ui/issue/IssueFragment.java | 81 +++++++++---------- .../ui/issue/IssueListAdapter.java | 10 +-- .../ui/issue/IssueSearchActivity.java | 14 ++-- .../issue/IssueSearchSuggestionsProvider.java | 2 +- .../ui/issue/IssuesFragment.java | 34 ++++---- .../ui/issue/IssuesPagerAdapter.java | 20 ++--- .../ui/issue/IssuesViewActivity.java | 36 ++++----- .../ui/issue/LabelDrawableSpan.java | 8 +- .../ui/issue/LabelsDialog.java | 10 +-- .../ui/issue/LabelsDialogFragment.java | 10 +-- .../ui/issue/MilestoneDialog.java | 10 +-- .../ui/issue/MilestoneDialogFragment.java | 8 +- .../ui/issue/RepositoryIssueListAdapter.java | 10 +-- .../ui/issue/SearchIssueListAdapter.java | 8 +- .../ui/issue/SearchIssueListFragment.java | 12 +-- .../ui/ref/BranchFileViewActivity.java | 40 ++++----- .../ui/ref/CodeTreeAdapter.java | 14 ++-- .../ui/ref/RefDialog.java | 12 +-- .../ui/ref/RefDialogFragment.java | 12 +-- .../ui/repo/ContributorListAdapter.java | 6 +- .../ui/repo/DefaultRepositoryListAdapter.java | 8 +- .../ui/repo/OrganizationLoader.java | 12 +-- .../ui/repo/RecentRepositories.java | 6 +- .../repo/RepositoryContributorsActivity.java | 12 +-- .../repo/RepositoryContributorsFragment.java | 18 ++--- .../ui/repo/RepositoryListAdapter.java | 12 +-- .../ui/repo/RepositoryListFragment.java | 28 +++---- .../ui/repo/RepositoryNewsFragment.java | 16 ++-- .../ui/repo/RepositoryPagerAdapter.java | 12 +-- .../ui/repo/RepositoryViewActivity.java | 46 +++++------ .../ui/repo/UserRepositoryListAdapter.java | 8 +- .../ui/repo/UserRepositoryListFragment.java | 14 ++-- ...ActionBarAccountAuthenticatorActivity.java | 2 +- ...ActionBarAccountAuthenticatorActivity.java | 2 +- .../roboactivities/RoboActionBarActivity.java | 2 +- .../roboactivities/RoboSupportFragment.java | 2 +- .../RepositorySearchSuggestionsProvider.java | 2 +- .../ui/search/SearchActivity.java | 14 ++-- .../ui/search/SearchPagerAdapter.java | 6 +- .../search/SearchRepositoryListAdapter.java | 10 +-- .../search/SearchRepositoryListFragment.java | 12 +-- .../ui/search/SearchUserListAdapter.java | 8 +- .../ui/search/SearchUserListFragment.java | 20 ++--- .../ui/user/EventPager.java | 4 +- .../ui/user/EventType.java | 6 +- .../ui/user/FollowersFragment.java | 4 +- .../ui/user/FollowingFragment.java | 4 +- .../ui/user/HomePagerAdapter.java | 8 +- .../ui/user/HomePagerFragment.java | 8 +- .../ui/user/IconAndViewTextManager.java | 8 +- .../ui/user/MembersFragment.java | 14 ++-- .../ui/user/MyFollowersFragment.java | 6 +- .../ui/user/MyFollowingFragment.java | 6 +- .../ui/user/NewsListAdapter.java | 8 +- .../ui/user/OrganizationNewsFragment.java | 6 +- .../user/OrganizationSelectionListener.java | 2 +- .../user/OrganizationSelectionProvider.java | 2 +- .../ui/user/PagedUserFragment.java | 8 +- .../ui/user/UriLauncherActivity.java | 26 +++--- .../ui/user/UserCreatedNewsFragment.java | 4 +- .../ui/user/UserFollowersFragment.java | 8 +- .../ui/user/UserFollowingFragment.java | 8 +- .../ui/user/UserListAdapter.java | 6 +- .../ui/user/UserNewsFragment.java | 8 +- .../ui/user/UserPagerAdapter.java | 8 +- .../ui/user/UserReceivedNewsFragment.java | 4 +- .../ui/user/UserViewActivity.java | 32 ++++---- .../util/AvatarLoader.java | 4 +- .../util/GravatarUtils.java | 2 +- .../{mobile => pockethub}/util/HtmlUtils.java | 2 +- .../util/HttpImageGetter.java | 6 +- .../util/ImageUtils.java | 2 +- .../util/MarkdownUtils.java | 2 +- .../util/PreferenceUtils.java | 2 +- .../util/ServiceUtils.java | 2 +- .../util/ShareUtils.java | 2 +- .../util/SourceEditor.java | 4 +- .../{mobile => pockethub}/util/TimeUtils.java | 2 +- .../util/ToastUtils.java | 2 +- .../util/TypefaceUtils.java | 2 +- app/src/main/res/layout/activity_main.xml | 2 +- app/src/main/res/layout/commit_compare.xml | 2 +- app/src/main/res/layout/gist_file_view.xml | 2 +- app/src/main/res/layout/issue_search.xml | 2 +- .../main/res/layout/issues_filter_list.xml | 2 +- .../navigation_drawer_list_item_image.xml | 4 +- .../navigation_drawer_list_item_text.xml | 4 +- app/src/main/res/layout/pager.xml | 2 +- app/src/main/res/layout/pager_with_tabs.xml | 2 +- app/src/main/res/layout/pager_with_title.xml | 2 +- app/src/main/res/layout/repo_contributors.xml | 2 +- app/src/main/res/layout/repo_issue_list.xml | 2 +- .../ui/user/IconAndViewTextManagerTest.java | 4 +- 315 files changed, 1317 insertions(+), 1322 deletions(-) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/ActivityTest.java (98%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/FiltersViewActivityTest.java (90%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/NewsEventTextTest.java (98%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/commit/CommitUriMatcherTest.java (94%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/commit/CommitUtilsTest.java (98%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/commit/CreateCommentActivityTest.java (90%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/commit/DiffStylerTest.java (97%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/commit/FullCommitTest.java (97%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/gist/CreateCommentActivityTest.java (90%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/gist/CreateGistActivityTest.java (91%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/gist/GistFilesViewActivityTest.java (91%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/gist/GistStoreTest.java (94%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/gist/GistUriMatcherTest.java (95%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/issue/CreateCommentActivityTest.java (90%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/issue/EditIssueActivityTest.java (91%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/issue/EditIssuesFilterActivityTest.java (86%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/issue/IssueFilterTest.java (95%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/issue/IssueStoreTest.java (95%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/issue/IssueUriMatcherTest.java (97%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/ref/RefUtilsTest.java (97%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/repo/RecentRepositoriesTest.java (94%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/repo/RepositoryEventMatcherTest.java (94%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/repo/RepositoryUriMatcherTest.java (96%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/repo/SearchActivityTest.java (89%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/user/LoginActivityTest.java (85%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/user/UserComparatorTest.java (93%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/user/UserUriMatcherTest.java (96%) rename app/src/androidTest/java/com/github/{mobile => pockethub}/tests/util/HtmlUtilsTest.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/DefaultClient.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/GitHubModule.java (86%) rename app/src/main/java/com/github/{mobile => pockethub}/Intents.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/RequestCodes.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/RequestFuture.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/RequestReader.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/RequestWriter.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ResultCodes.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ServicesModule.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ThrowableLoader.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/AccountAuthenticator.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/AccountAuthenticatorService.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/AccountClient.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/AccountConstants.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/AccountScope.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/AccountUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/AuthenticatedUserLoader.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/AuthenticatedUserTask.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/GitHubAccount.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/LoginActivity.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/LoginWebViewActivity.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/ScopeBase.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/TwoFactorAuthActivity.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/TwoFactorAuthClient.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/accounts/TwoFactorAuthException.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/api/GitHubClientV2.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/core/ItemStore.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/OnLoadListener.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/core/ResourcePager.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/core/UrlMatcher.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/code/FullTree.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/code/RefreshBlobTask.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/core/code/RefreshTreeTask.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/CommitCompareTask.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/CommitMatch.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/CommitPager.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/CommitStore.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/CommitUriMatcher.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/CommitUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/FullCommit.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/FullCommitFile.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/commit/RefreshCommitTask.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/core/gist/FullGist.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/gist/GistEventMatcher.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/gist/GistPager.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/core/gist/GistStore.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/gist/GistUriMatcher.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/gist/RefreshGistTask.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/core/gist/StarGistTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/gist/UnstarGistTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/issue/FullIssue.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/issue/IssueEventMatcher.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/issue/IssueFilter.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/core/issue/IssuePager.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/core/issue/IssueStore.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/issue/IssueUriMatcher.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/core/issue/IssueUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/issue/RefreshIssueTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/ref/RefUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/DeleteRepositoryTask.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/ForkRepositoryTask.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/RefreshRepositoryTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/RepositoryEventMatcher.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/RepositoryUriMatcher.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/RepositoryUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/StarRepositoryTask.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/StarredRepositoryTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/repo/UnstarRepositoryTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/search/SearchUser.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/search/SearchUserService.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/core/user/FollowUserTask.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/core/user/FollowingUserTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/user/RefreshUserTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/user/UnfollowUserTask.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/core/user/UserComparator.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/core/user/UserEventMatcher.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/core/user/UserPager.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/core/user/UserUriMatcher.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/model/App.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/model/Authorization.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/persistence/AccountDataManager.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/persistence/CacheHelper.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/persistence/DatabaseCache.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/persistence/OrganizationRepositories.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/persistence/Organizations.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/persistence/PersistableResource.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/sync/ContentProviderAdapter.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/sync/SyncAdapter.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/sync/SyncAdapterService.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/sync/SyncCampaign.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/BaseActivity.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/CheckableRelativeLayout.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ConfirmDialogFragment.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/DialogFragment.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/DialogFragmentActivity.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/DialogFragmentHelper.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/DialogResultListener.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/FragmentPagerAdapter.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/FragmentProvider.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/FragmentStatePagerAdapter.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/HeaderFooterListAdapter.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ItemListFragment.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/LightAlertDialog.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/LightProgressDialog.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/MainActivity.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/MarkdownLoader.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/NavigationDrawerAdapter.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/NavigationDrawerFragment.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/NavigationDrawerObject.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/NewsFragment.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/PagedItemFragment.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/PagerActivity.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/PagerFragment.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/PatchedScrollingViewBehavior.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ProgressDialogTask.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ResourceLoadingIndicator.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/SelectableLinkMovementMethod.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/SingleChoiceDialogFragment.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/StyledText.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/TabPagerActivity.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/TabPagerFragment.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/TextWatcherAdapter.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ViewPager.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/WebView.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/code/RepositoryCodeFragment.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/comment/CommentListAdapter.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/comment/CommentPreviewPagerAdapter.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/comment/CreateCommentActivity.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/comment/DeleteCommentListener.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/comment/EditCommentListener.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/comment/RawCommentFragment.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/comment/RenderedCommentFragment.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitCompareListFragment.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitCompareViewActivity.java (87%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitDiffListFragment.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitFileComparator.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitFileListAdapter.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitFileViewActivity.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitListAdapter.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitListFragment.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitPagerAdapter.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CommitViewActivity.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CreateCommentActivity.java (86%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/CreateCommentTask.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/commit/DiffStyler.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/CreateCommentActivity.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/CreateCommentTask.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/CreateGistActivity.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/CreateGistTask.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/DeleteCommentTask.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/DeleteGistTask.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/EditCommentActivity.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/EditCommentTask.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistFileFragment.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistFilesPagerAdapter.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistFilesViewActivity.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistFragment.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistListAdapter.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistQueriesPagerAdapter.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistsFragment.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistsPagerAdapter.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistsPagerFragment.java (82%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/GistsViewActivity.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/MyGistsFragment.java (84%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/PublicGistsFragment.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/RandomGistTask.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/gist/StarredGistsFragment.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/AssigneeDialog.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/AssigneeDialogFragment.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/CreateCommentActivity.java (83%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/CreateCommentTask.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/CreateIssueTask.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/DashboardIssueFragment.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/DashboardIssueListAdapter.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/DeleteCommentTask.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditAssigneeTask.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditCommentActivity.java (85%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditCommentTask.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditIssueActivity.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditIssueTask.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditIssuesFilterActivity.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditLabelsTask.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditMilestoneTask.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/EditStateTask.java (87%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/FilterListAdapter.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/FilterListFragment.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/FiltersViewActivity.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/FiltersViewFragment.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssueBrowseActivity.java (86%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssueDashboardPagerAdapter.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssueDashboardPagerFragment.java (84%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssueFragment.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssueListAdapter.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssueSearchActivity.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssueSearchSuggestionsProvider.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssuesFragment.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssuesPagerAdapter.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/IssuesViewActivity.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/LabelDrawableSpan.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/LabelsDialog.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/LabelsDialogFragment.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/MilestoneDialog.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/MilestoneDialogFragment.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/RepositoryIssueListAdapter.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/SearchIssueListAdapter.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/issue/SearchIssueListFragment.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ref/BranchFileViewActivity.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ref/CodeTreeAdapter.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ref/RefDialog.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/ref/RefDialogFragment.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/ContributorListAdapter.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/DefaultRepositoryListAdapter.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/OrganizationLoader.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/RecentRepositories.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/RepositoryContributorsActivity.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/RepositoryContributorsFragment.java (87%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/RepositoryListAdapter.java (86%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/RepositoryListFragment.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/RepositoryNewsFragment.java (84%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/RepositoryPagerAdapter.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/RepositoryViewActivity.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/UserRepositoryListAdapter.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/repo/UserRepositoryListFragment.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/roboactivities/ActionBarAccountAuthenticatorActivity.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/roboactivities/RoboActionBarAccountAuthenticatorActivity.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/roboactivities/RoboActionBarActivity.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/roboactivities/RoboSupportFragment.java (92%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/search/RepositorySearchSuggestionsProvider.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/search/SearchActivity.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/search/SearchPagerAdapter.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/search/SearchRepositoryListAdapter.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/search/SearchRepositoryListFragment.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/search/SearchUserListAdapter.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/search/SearchUserListFragment.java (85%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/EventPager.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/EventType.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/FollowersFragment.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/FollowingFragment.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/HomePagerAdapter.java (94%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/HomePagerFragment.java (86%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/IconAndViewTextManager.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/MembersFragment.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/MyFollowersFragment.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/MyFollowingFragment.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/NewsListAdapter.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/OrganizationNewsFragment.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/OrganizationSelectionListener.java (95%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/OrganizationSelectionProvider.java (96%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/PagedUserFragment.java (90%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UriLauncherActivity.java (89%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UserCreatedNewsFragment.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UserFollowersFragment.java (87%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UserFollowingFragment.java (87%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UserListAdapter.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UserNewsFragment.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UserPagerAdapter.java (91%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UserReceivedNewsFragment.java (93%) rename app/src/main/java/com/github/{mobile => pockethub}/ui/user/UserViewActivity.java (88%) rename app/src/main/java/com/github/{mobile => pockethub}/util/AvatarLoader.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/util/GravatarUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/util/HtmlUtils.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/util/HttpImageGetter.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/util/ImageUtils.java (99%) rename app/src/main/java/com/github/{mobile => pockethub}/util/MarkdownUtils.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/util/PreferenceUtils.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/util/ServiceUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/util/ShareUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/util/SourceEditor.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/util/TimeUtils.java (97%) rename app/src/main/java/com/github/{mobile => pockethub}/util/ToastUtils.java (98%) rename app/src/main/java/com/github/{mobile => pockethub}/util/TypefaceUtils.java (99%) rename app/src/test/java/com/github/{mobile => pockethub}/ui/user/IconAndViewTextManagerTest.java (99%) diff --git a/app/build.gradle b/app/build.gradle index f7e9378c6..c457e0a89 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion '22.0.1' defaultConfig { - applicationId 'com.github.mobile' + applicationId 'com.github.pockethub' minSdkVersion 15 targetSdkVersion 22 versionCode 1900 diff --git a/app/src/androidTest/AndroidManifest.xml b/app/src/androidTest/AndroidManifest.xml index 3fe4feadd..c4a3b5888 100644 --- a/app/src/androidTest/AndroidManifest.xml +++ b/app/src/androidTest/AndroidManifest.xml @@ -1,6 +1,6 @@ diff --git a/app/src/androidTest/java/com/github/mobile/tests/ActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/ActivityTest.java similarity index 98% rename from app/src/androidTest/java/com/github/mobile/tests/ActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/ActivityTest.java index f3babb1e3..c8cb934a2 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/ActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/ActivityTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests; +package com.github.pockethub.tests; import android.app.Activity; import android.test.ActivityInstrumentationTestCase2; diff --git a/app/src/androidTest/java/com/github/mobile/tests/FiltersViewActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/FiltersViewActivityTest.java similarity index 90% rename from app/src/androidTest/java/com/github/mobile/tests/FiltersViewActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/FiltersViewActivityTest.java index 28d82c59c..124da5cd9 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/FiltersViewActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/FiltersViewActivityTest.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests; +package com.github.pockethub.tests; -import com.github.mobile.ui.issue.FiltersViewActivity; +import com.github.pockethub.ui.issue.FiltersViewActivity; /** * Test of {@link FiltersViewActivity} diff --git a/app/src/androidTest/java/com/github/mobile/tests/NewsEventTextTest.java b/app/src/androidTest/java/com/github/pockethub/tests/NewsEventTextTest.java similarity index 98% rename from app/src/androidTest/java/com/github/mobile/tests/NewsEventTextTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/NewsEventTextTest.java index 65f704821..166ee2b4c 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/NewsEventTextTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/NewsEventTextTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests; +package com.github.pockethub.tests; import static org.eclipse.egit.github.core.event.Event.TYPE_COMMIT_COMMENT; import static org.eclipse.egit.github.core.event.Event.TYPE_CREATE; @@ -36,9 +36,9 @@ import android.view.View; import android.widget.TextView; -import com.github.mobile.R.id; -import com.github.mobile.ui.user.NewsListAdapter; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R.id; +import com.github.pockethub.ui.user.NewsListAdapter; +import com.github.pockethub.util.AvatarLoader; import java.util.Date; diff --git a/app/src/androidTest/java/com/github/mobile/tests/commit/CommitUriMatcherTest.java b/app/src/androidTest/java/com/github/pockethub/tests/commit/CommitUriMatcherTest.java similarity index 94% rename from app/src/androidTest/java/com/github/mobile/tests/commit/CommitUriMatcherTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/commit/CommitUriMatcherTest.java index 676c74252..94d446af3 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/commit/CommitUriMatcherTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/commit/CommitUriMatcherTest.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.commit; +package com.github.pockethub.tests.commit; import android.net.Uri; import android.test.AndroidTestCase; -import com.github.mobile.core.commit.CommitMatch; -import com.github.mobile.core.commit.CommitUriMatcher; +import com.github.pockethub.core.commit.CommitMatch; +import com.github.pockethub.core.commit.CommitUriMatcher; /** * Tests of {@link CommitUriMatcher} diff --git a/app/src/androidTest/java/com/github/mobile/tests/commit/CommitUtilsTest.java b/app/src/androidTest/java/com/github/pockethub/tests/commit/CommitUtilsTest.java similarity index 98% rename from app/src/androidTest/java/com/github/mobile/tests/commit/CommitUtilsTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/commit/CommitUtilsTest.java index 6735984e3..5a6f7d541 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/commit/CommitUtilsTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/commit/CommitUtilsTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.commit; +package com.github.pockethub.tests.commit; import android.test.AndroidTestCase; -import com.github.mobile.core.commit.CommitUtils; +import com.github.pockethub.core.commit.CommitUtils; import java.util.Date; diff --git a/app/src/androidTest/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/commit/CreateCommentActivityTest.java similarity index 90% rename from app/src/androidTest/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/commit/CreateCommentActivityTest.java index 3337c5f07..028edbb8a 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/commit/CreateCommentActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/commit/CreateCommentActivityTest.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.commit; +package com.github.pockethub.tests.commit; import static android.view.KeyEvent.KEYCODE_DEL; import android.view.View; import android.widget.EditText; -import com.github.mobile.R.id; -import com.github.mobile.tests.ActivityTest; -import com.github.mobile.ui.commit.CreateCommentActivity; +import com.github.pockethub.R.id; +import com.github.pockethub.tests.ActivityTest; +import com.github.pockethub.ui.commit.CreateCommentActivity; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/commit/DiffStylerTest.java b/app/src/androidTest/java/com/github/pockethub/tests/commit/DiffStylerTest.java similarity index 97% rename from app/src/androidTest/java/com/github/mobile/tests/commit/DiffStylerTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/commit/DiffStylerTest.java index b222d5db0..f741789b5 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/commit/DiffStylerTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/commit/DiffStylerTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.commit; +package com.github.pockethub.tests.commit; import android.test.AndroidTestCase; -import com.github.mobile.ui.commit.DiffStyler; +import com.github.pockethub.ui.commit.DiffStyler; import java.io.BufferedReader; import java.io.IOException; diff --git a/app/src/androidTest/java/com/github/mobile/tests/commit/FullCommitTest.java b/app/src/androidTest/java/com/github/pockethub/tests/commit/FullCommitTest.java similarity index 97% rename from app/src/androidTest/java/com/github/mobile/tests/commit/FullCommitTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/commit/FullCommitTest.java index eedb6a5dd..232f5a627 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/commit/FullCommitTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/commit/FullCommitTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.commit; +package com.github.pockethub.tests.commit; import android.test.AndroidTestCase; -import com.github.mobile.core.commit.FullCommit; +import com.github.pockethub.core.commit.FullCommit; import java.util.ArrayList; import java.util.Arrays; diff --git a/app/src/androidTest/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/gist/CreateCommentActivityTest.java similarity index 90% rename from app/src/androidTest/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/gist/CreateCommentActivityTest.java index 2ae49dfb5..545e25841 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/gist/CreateCommentActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/gist/CreateCommentActivityTest.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.gist; +package com.github.pockethub.tests.gist; import static android.view.KeyEvent.KEYCODE_DEL; import android.view.View; import android.widget.EditText; -import com.github.mobile.R.id; -import com.github.mobile.tests.ActivityTest; -import com.github.mobile.ui.gist.CreateCommentActivity; +import com.github.pockethub.R.id; +import com.github.pockethub.tests.ActivityTest; +import com.github.pockethub.ui.gist.CreateCommentActivity; import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/gist/CreateGistActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/gist/CreateGistActivityTest.java similarity index 91% rename from app/src/androidTest/java/com/github/mobile/tests/gist/CreateGistActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/gist/CreateGistActivityTest.java index d3a764722..b1347b526 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/gist/CreateGistActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/gist/CreateGistActivityTest.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.gist; +package com.github.pockethub.tests.gist; import static android.content.Intent.EXTRA_TEXT; import android.content.Intent; import android.view.View; import android.widget.EditText; -import com.github.mobile.R.id; -import com.github.mobile.tests.ActivityTest; -import com.github.mobile.ui.gist.CreateGistActivity; +import com.github.pockethub.R.id; +import com.github.pockethub.tests.ActivityTest; +import com.github.pockethub.ui.gist.CreateGistActivity; /** * Tests of {@link CreateGistActivity} diff --git a/app/src/androidTest/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/gist/GistFilesViewActivityTest.java similarity index 91% rename from app/src/androidTest/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/gist/GistFilesViewActivityTest.java index 10ca670da..4464cb4c6 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/gist/GistFilesViewActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/gist/GistFilesViewActivityTest.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.gist; +package com.github.pockethub.tests.gist; import android.support.v4.view.ViewPager; -import com.github.mobile.R.id; -import com.github.mobile.core.gist.GistStore; -import com.github.mobile.tests.ActivityTest; -import com.github.mobile.ui.gist.GistFilesViewActivity; +import com.github.pockethub.R.id; +import com.github.pockethub.core.gist.GistStore; +import com.github.pockethub.tests.ActivityTest; +import com.github.pockethub.ui.gist.GistFilesViewActivity; import com.google.inject.Inject; import java.util.LinkedHashMap; diff --git a/app/src/androidTest/java/com/github/mobile/tests/gist/GistStoreTest.java b/app/src/androidTest/java/com/github/pockethub/tests/gist/GistStoreTest.java similarity index 94% rename from app/src/androidTest/java/com/github/mobile/tests/gist/GistStoreTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/gist/GistStoreTest.java index 16712b8db..abfdaedef 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/gist/GistStoreTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/gist/GistStoreTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.gist; +package com.github.pockethub.tests.gist; import android.test.AndroidTestCase; -import com.github.mobile.core.gist.GistStore; +import com.github.pockethub.core.gist.GistStore; import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.service.GistService; diff --git a/app/src/androidTest/java/com/github/mobile/tests/gist/GistUriMatcherTest.java b/app/src/androidTest/java/com/github/pockethub/tests/gist/GistUriMatcherTest.java similarity index 95% rename from app/src/androidTest/java/com/github/mobile/tests/gist/GistUriMatcherTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/gist/GistUriMatcherTest.java index 19b48c213..ee008e8e9 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/gist/GistUriMatcherTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/gist/GistUriMatcherTest.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.gist; +package com.github.pockethub.tests.gist; import android.net.Uri; import android.test.AndroidTestCase; -import com.github.mobile.core.gist.GistUriMatcher; +import com.github.pockethub.core.gist.GistUriMatcher; import org.eclipse.egit.github.core.Gist; diff --git a/app/src/androidTest/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/issue/CreateCommentActivityTest.java similarity index 90% rename from app/src/androidTest/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/issue/CreateCommentActivityTest.java index d62149222..68cbc308e 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/issue/CreateCommentActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/issue/CreateCommentActivityTest.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.issue; +package com.github.pockethub.tests.issue; import static android.view.KeyEvent.KEYCODE_DEL; import android.view.View; import android.widget.EditText; -import com.github.mobile.R.id; -import com.github.mobile.tests.ActivityTest; -import com.github.mobile.ui.issue.CreateCommentActivity; +import com.github.pockethub.R.id; +import com.github.pockethub.tests.ActivityTest; +import com.github.pockethub.ui.issue.CreateCommentActivity; import org.eclipse.egit.github.core.RepositoryId; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/issue/EditIssueActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/issue/EditIssueActivityTest.java similarity index 91% rename from app/src/androidTest/java/com/github/mobile/tests/issue/EditIssueActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/issue/EditIssueActivityTest.java index 38c262b29..a2bc71f88 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/issue/EditIssueActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/issue/EditIssueActivityTest.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.issue; +package com.github.pockethub.tests.issue; import static android.view.KeyEvent.KEYCODE_DEL; import android.view.View; import android.widget.EditText; -import com.github.mobile.R.id; -import com.github.mobile.tests.ActivityTest; -import com.github.mobile.ui.issue.EditIssueActivity; +import com.github.pockethub.R.id; +import com.github.pockethub.tests.ActivityTest; +import com.github.pockethub.ui.issue.EditIssueActivity; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/issue/EditIssuesFilterActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/issue/EditIssuesFilterActivityTest.java similarity index 86% rename from app/src/androidTest/java/com/github/mobile/tests/issue/EditIssuesFilterActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/issue/EditIssuesFilterActivityTest.java index 18ca96e02..84b90cdfd 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/issue/EditIssuesFilterActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/issue/EditIssuesFilterActivityTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.issue; +package com.github.pockethub.tests.issue; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.tests.ActivityTest; -import com.github.mobile.ui.issue.EditIssuesFilterActivity; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.tests.ActivityTest; +import com.github.pockethub.ui.issue.EditIssuesFilterActivity; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/issue/IssueFilterTest.java b/app/src/androidTest/java/com/github/pockethub/tests/issue/IssueFilterTest.java similarity index 95% rename from app/src/androidTest/java/com/github/mobile/tests/issue/IssueFilterTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/issue/IssueFilterTest.java index f131a79b8..4826dd0d4 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/issue/IssueFilterTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/issue/IssueFilterTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.issue; +package com.github.pockethub.tests.issue; import android.test.AndroidTestCase; -import com.github.mobile.core.issue.IssueFilter; +import com.github.pockethub.core.issue.IssueFilter; import org.eclipse.egit.github.core.Milestone; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/androidTest/java/com/github/mobile/tests/issue/IssueStoreTest.java b/app/src/androidTest/java/com/github/pockethub/tests/issue/IssueStoreTest.java similarity index 95% rename from app/src/androidTest/java/com/github/mobile/tests/issue/IssueStoreTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/issue/IssueStoreTest.java index 5045d7f22..d524acdd4 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/issue/IssueStoreTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/issue/IssueStoreTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.issue; +package com.github.pockethub.tests.issue; import android.test.AndroidTestCase; -import com.github.mobile.core.issue.IssueStore; +import com.github.pockethub.core.issue.IssueStore; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.RepositoryIssue; diff --git a/app/src/androidTest/java/com/github/mobile/tests/issue/IssueUriMatcherTest.java b/app/src/androidTest/java/com/github/pockethub/tests/issue/IssueUriMatcherTest.java similarity index 97% rename from app/src/androidTest/java/com/github/mobile/tests/issue/IssueUriMatcherTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/issue/IssueUriMatcherTest.java index 5ad924c73..bc7dc0b97 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/issue/IssueUriMatcherTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/issue/IssueUriMatcherTest.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.issue; +package com.github.pockethub.tests.issue; import android.net.Uri; import android.test.AndroidTestCase; -import com.github.mobile.core.issue.IssueUriMatcher; +import com.github.pockethub.core.issue.IssueUriMatcher; import org.eclipse.egit.github.core.RepositoryIssue; diff --git a/app/src/androidTest/java/com/github/mobile/tests/ref/RefUtilsTest.java b/app/src/androidTest/java/com/github/pockethub/tests/ref/RefUtilsTest.java similarity index 97% rename from app/src/androidTest/java/com/github/mobile/tests/ref/RefUtilsTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/ref/RefUtilsTest.java index 115c2a485..856a1dcad 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/ref/RefUtilsTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/ref/RefUtilsTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.ref; +package com.github.pockethub.tests.ref; import android.test.AndroidTestCase; -import com.github.mobile.core.ref.RefUtils; +import com.github.pockethub.core.ref.RefUtils; import org.eclipse.egit.github.core.Reference; diff --git a/app/src/androidTest/java/com/github/mobile/tests/repo/RecentRepositoriesTest.java b/app/src/androidTest/java/com/github/pockethub/tests/repo/RecentRepositoriesTest.java similarity index 94% rename from app/src/androidTest/java/com/github/mobile/tests/repo/RecentRepositoriesTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/repo/RecentRepositoriesTest.java index bc6e4feb8..1c0deed61 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/repo/RecentRepositoriesTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/repo/RecentRepositoriesTest.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.repo; +package com.github.pockethub.tests.repo; -import static com.github.mobile.ui.repo.RecentRepositories.MAX_SIZE; +import static com.github.pockethub.ui.repo.RecentRepositories.MAX_SIZE; import android.test.AndroidTestCase; -import com.github.mobile.ui.repo.RecentRepositories; +import com.github.pockethub.ui.repo.RecentRepositories; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/repo/RepositoryEventMatcherTest.java b/app/src/androidTest/java/com/github/pockethub/tests/repo/RepositoryEventMatcherTest.java similarity index 94% rename from app/src/androidTest/java/com/github/mobile/tests/repo/RepositoryEventMatcherTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/repo/RepositoryEventMatcherTest.java index c1c4ccb60..1512c5520 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/repo/RepositoryEventMatcherTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/repo/RepositoryEventMatcherTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.repo; +package com.github.pockethub.tests.repo; import android.test.AndroidTestCase; -import com.github.mobile.core.repo.RepositoryEventMatcher; +import com.github.pockethub.core.repo.RepositoryEventMatcher; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/repo/RepositoryUriMatcherTest.java b/app/src/androidTest/java/com/github/pockethub/tests/repo/RepositoryUriMatcherTest.java similarity index 96% rename from app/src/androidTest/java/com/github/mobile/tests/repo/RepositoryUriMatcherTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/repo/RepositoryUriMatcherTest.java index ebbac6481..96a3d63a6 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/repo/RepositoryUriMatcherTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/repo/RepositoryUriMatcherTest.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.repo; +package com.github.pockethub.tests.repo; import android.net.Uri; import android.test.AndroidTestCase; -import com.github.mobile.core.repo.RepositoryUriMatcher; +import com.github.pockethub.core.repo.RepositoryUriMatcher; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/androidTest/java/com/github/mobile/tests/repo/SearchActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/repo/SearchActivityTest.java similarity index 89% rename from app/src/androidTest/java/com/github/mobile/tests/repo/SearchActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/repo/SearchActivityTest.java index b3ea7062b..9d045b747 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/repo/SearchActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/repo/SearchActivityTest.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.repo; +package com.github.pockethub.tests.repo; import static android.app.SearchManager.QUERY; import static android.content.Intent.ACTION_SEARCH; import android.content.Intent; -import com.github.mobile.tests.ActivityTest; -import com.github.mobile.ui.search.SearchActivity; +import com.github.pockethub.tests.ActivityTest; +import com.github.pockethub.ui.search.SearchActivity; /** * Tests of {@link SearchActivity} diff --git a/app/src/androidTest/java/com/github/mobile/tests/user/LoginActivityTest.java b/app/src/androidTest/java/com/github/pockethub/tests/user/LoginActivityTest.java similarity index 85% rename from app/src/androidTest/java/com/github/mobile/tests/user/LoginActivityTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/user/LoginActivityTest.java index 9a87cdcc3..13fe2fb12 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/user/LoginActivityTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/user/LoginActivityTest.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.user; +package com.github.pockethub.tests.user; import android.accounts.AccountManager; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.accounts.LoginActivity; -import com.github.mobile.tests.ActivityTest; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.accounts.LoginActivity; +import com.github.pockethub.tests.ActivityTest; /** * Tests of {@link LoginActivity} diff --git a/app/src/androidTest/java/com/github/mobile/tests/user/UserComparatorTest.java b/app/src/androidTest/java/com/github/pockethub/tests/user/UserComparatorTest.java similarity index 93% rename from app/src/androidTest/java/com/github/mobile/tests/user/UserComparatorTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/user/UserComparatorTest.java index 66f903bdd..1c5457308 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/user/UserComparatorTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/user/UserComparatorTest.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.user; +package com.github.pockethub.tests.user; import android.accounts.Account; import android.accounts.AccountManager; import android.test.AndroidTestCase; -import com.github.mobile.accounts.GitHubAccount; -import com.github.mobile.core.user.UserComparator; +import com.github.pockethub.accounts.GitHubAccount; +import com.github.pockethub.core.user.UserComparator; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/user/UserUriMatcherTest.java b/app/src/androidTest/java/com/github/pockethub/tests/user/UserUriMatcherTest.java similarity index 96% rename from app/src/androidTest/java/com/github/mobile/tests/user/UserUriMatcherTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/user/UserUriMatcherTest.java index b1a04ff10..f1070d100 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/user/UserUriMatcherTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/user/UserUriMatcherTest.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.user; +package com.github.pockethub.tests.user; import android.net.Uri; import android.test.AndroidTestCase; -import com.github.mobile.core.user.UserUriMatcher; +import com.github.pockethub.core.user.UserUriMatcher; import org.eclipse.egit.github.core.User; diff --git a/app/src/androidTest/java/com/github/mobile/tests/util/HtmlUtilsTest.java b/app/src/androidTest/java/com/github/pockethub/tests/util/HtmlUtilsTest.java similarity index 98% rename from app/src/androidTest/java/com/github/mobile/tests/util/HtmlUtilsTest.java rename to app/src/androidTest/java/com/github/pockethub/tests/util/HtmlUtilsTest.java index 48638c1df..457481303 100644 --- a/app/src/androidTest/java/com/github/mobile/tests/util/HtmlUtilsTest.java +++ b/app/src/androidTest/java/com/github/pockethub/tests/util/HtmlUtilsTest.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.tests.util; +package com.github.pockethub.tests.util; import android.test.AndroidTestCase; -import com.github.mobile.util.HtmlUtils; +import com.github.pockethub.util.HtmlUtils; /** * Unit tests of HTML conversions done when rendering markdown diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1c344f94f..74902a676 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="com.github.pockethub"> @@ -26,7 +26,7 @@ android:theme="@style/Theme.GitHub"> @@ -42,7 +42,7 @@ android:value=".ui.search.SearchActivity" /> @@ -53,7 +53,7 @@ @@ -67,7 +67,7 @@ android:value=".ui.issue.IssueSearchActivity" /> @@ -76,7 +76,7 @@ @@ -85,7 +85,7 @@ @@ -109,7 +109,7 @@ @@ -118,7 +118,7 @@ @@ -127,7 +127,7 @@ @@ -136,7 +136,7 @@ @@ -145,7 +145,7 @@ @@ -154,7 +154,7 @@ @@ -163,7 +163,7 @@ @@ -172,7 +172,7 @@ @@ -186,7 +186,7 @@ android:value=".ui.issue.IssueSearchActivity" /> @@ -196,7 +196,7 @@ @@ -206,7 +206,7 @@ @@ -216,7 +216,7 @@ @@ -229,7 +229,7 @@ @@ -244,7 +244,7 @@ @@ -254,7 +254,7 @@ --> @@ -295,7 +295,7 @@ @@ -319,7 +319,7 @@ @@ -328,7 +328,7 @@ @@ -337,7 +337,7 @@ @@ -346,10 +346,10 @@ - + @@ -362,17 +362,17 @@ diff --git a/app/src/main/java/com/github/mobile/DefaultClient.java b/app/src/main/java/com/github/pockethub/DefaultClient.java similarity index 97% rename from app/src/main/java/com/github/mobile/DefaultClient.java rename to app/src/main/java/com/github/pockethub/DefaultClient.java index 7b0c9e9c3..51ada63e3 100644 --- a/app/src/main/java/com/github/mobile/DefaultClient.java +++ b/app/src/main/java/com/github/pockethub/DefaultClient.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; import org.eclipse.egit.github.core.client.GitHubClient; diff --git a/app/src/main/java/com/github/mobile/GitHubModule.java b/app/src/main/java/com/github/pockethub/GitHubModule.java similarity index 86% rename from app/src/main/java/com/github/mobile/GitHubModule.java rename to app/src/main/java/com/github/pockethub/GitHubModule.java index f6a23aa9d..331a07116 100644 --- a/app/src/main/java/com/github/mobile/GitHubModule.java +++ b/app/src/main/java/com/github/pockethub/GitHubModule.java @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; import android.content.Context; -import com.github.mobile.accounts.AccountClient; -import com.github.mobile.accounts.AccountScope; -import com.github.mobile.accounts.GitHubAccount; -import com.github.mobile.core.commit.CommitStore; -import com.github.mobile.core.gist.GistStore; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.persistence.OrganizationRepositories; -import com.github.mobile.sync.SyncCampaign; +import com.github.pockethub.accounts.AccountClient; +import com.github.pockethub.accounts.AccountScope; +import com.github.pockethub.accounts.GitHubAccount; +import com.github.pockethub.core.commit.CommitStore; +import com.github.pockethub.core.gist.GistStore; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.persistence.OrganizationRepositories; +import com.github.pockethub.sync.SyncCampaign; import com.google.inject.AbstractModule; import com.google.inject.Provider; import com.google.inject.Provides; diff --git a/app/src/main/java/com/github/mobile/Intents.java b/app/src/main/java/com/github/pockethub/Intents.java similarity index 99% rename from app/src/main/java/com/github/mobile/Intents.java rename to app/src/main/java/com/github/pockethub/Intents.java index 9482b4a04..86ffd46c1 100644 --- a/app/src/main/java/com/github/mobile/Intents.java +++ b/app/src/main/java/com/github/pockethub/Intents.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; import static org.eclipse.egit.github.core.RepositoryId.createFromUrl; import android.content.Intent; diff --git a/app/src/main/java/com/github/mobile/RequestCodes.java b/app/src/main/java/com/github/pockethub/RequestCodes.java similarity index 98% rename from app/src/main/java/com/github/mobile/RequestCodes.java rename to app/src/main/java/com/github/pockethub/RequestCodes.java index fbeb07153..6f8ef3d9d 100644 --- a/app/src/main/java/com/github/mobile/RequestCodes.java +++ b/app/src/main/java/com/github/pockethub/RequestCodes.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; /** * Request codes diff --git a/app/src/main/java/com/github/mobile/RequestFuture.java b/app/src/main/java/com/github/pockethub/RequestFuture.java similarity index 96% rename from app/src/main/java/com/github/mobile/RequestFuture.java rename to app/src/main/java/com/github/pockethub/RequestFuture.java index d5158d4e9..c3db7b4b6 100644 --- a/app/src/main/java/com/github/mobile/RequestFuture.java +++ b/app/src/main/java/com/github/pockethub/RequestFuture.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; /** * Request future delivering a response diff --git a/app/src/main/java/com/github/mobile/RequestReader.java b/app/src/main/java/com/github/pockethub/RequestReader.java similarity index 99% rename from app/src/main/java/com/github/mobile/RequestReader.java rename to app/src/main/java/com/github/pockethub/RequestReader.java index b113bddba..d403ceb3e 100644 --- a/app/src/main/java/com/github/mobile/RequestReader.java +++ b/app/src/main/java/com/github/pockethub/RequestReader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; import android.util.Log; diff --git a/app/src/main/java/com/github/mobile/RequestWriter.java b/app/src/main/java/com/github/pockethub/RequestWriter.java similarity index 98% rename from app/src/main/java/com/github/mobile/RequestWriter.java rename to app/src/main/java/com/github/pockethub/RequestWriter.java index f216fd61d..1bbcca632 100644 --- a/app/src/main/java/com/github/mobile/RequestWriter.java +++ b/app/src/main/java/com/github/pockethub/RequestWriter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; import android.util.Log; diff --git a/app/src/main/java/com/github/mobile/ResultCodes.java b/app/src/main/java/com/github/pockethub/ResultCodes.java similarity index 96% rename from app/src/main/java/com/github/mobile/ResultCodes.java rename to app/src/main/java/com/github/pockethub/ResultCodes.java index 427dc2f8c..6bbe5117a 100644 --- a/app/src/main/java/com/github/mobile/ResultCodes.java +++ b/app/src/main/java/com/github/pockethub/ResultCodes.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; import static android.app.Activity.RESULT_FIRST_USER; diff --git a/app/src/main/java/com/github/mobile/ServicesModule.java b/app/src/main/java/com/github/pockethub/ServicesModule.java similarity index 97% rename from app/src/main/java/com/github/mobile/ServicesModule.java rename to app/src/main/java/com/github/pockethub/ServicesModule.java index 1800c10e4..9b754d498 100644 --- a/app/src/main/java/com/github/mobile/ServicesModule.java +++ b/app/src/main/java/com/github/pockethub/ServicesModule.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; -import com.github.mobile.core.search.SearchUserService; +import com.github.pockethub.core.search.SearchUserService; import com.google.inject.AbstractModule; import com.google.inject.Provides; diff --git a/app/src/main/java/com/github/mobile/ThrowableLoader.java b/app/src/main/java/com/github/pockethub/ThrowableLoader.java similarity index 94% rename from app/src/main/java/com/github/mobile/ThrowableLoader.java rename to app/src/main/java/com/github/pockethub/ThrowableLoader.java index a14044161..4867aab27 100644 --- a/app/src/main/java/com/github/mobile/ThrowableLoader.java +++ b/app/src/main/java/com/github/pockethub/ThrowableLoader.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile; +package com.github.pockethub; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.accounts.AuthenticatedUserLoader; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.accounts.AuthenticatedUserLoader; /** * Loader that support throwing an exception when loading in the background diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java b/app/src/main/java/com/github/pockethub/accounts/AccountAuthenticator.java similarity index 94% rename from app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java rename to app/src/main/java/com/github/pockethub/accounts/AccountAuthenticator.java index b0b1ccc03..d7823789e 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java +++ b/app/src/main/java/com/github/pockethub/accounts/AccountAuthenticator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import static android.accounts.AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE; import static android.accounts.AccountManager.KEY_ACCOUNT_NAME; @@ -21,11 +21,11 @@ import static android.accounts.AccountManager.KEY_AUTHTOKEN; import static android.accounts.AccountManager.KEY_BOOLEAN_RESULT; import static android.accounts.AccountManager.KEY_INTENT; -import static com.github.mobile.accounts.AccountConstants.ACCOUNT_TYPE; -import static com.github.mobile.accounts.AccountConstants.APP_NOTE; -import static com.github.mobile.accounts.AccountConstants.APP_NOTE_URL; -import static com.github.mobile.accounts.LoginActivity.PARAM_AUTHTOKEN_TYPE; -import static com.github.mobile.accounts.LoginActivity.PARAM_USERNAME; +import static com.github.pockethub.accounts.AccountConstants.ACCOUNT_TYPE; +import static com.github.pockethub.accounts.AccountConstants.APP_NOTE; +import static com.github.pockethub.accounts.AccountConstants.APP_NOTE_URL; +import static com.github.pockethub.accounts.LoginActivity.PARAM_AUTHTOKEN_TYPE; +import static com.github.pockethub.accounts.LoginActivity.PARAM_USERNAME; import android.accounts.AbstractAccountAuthenticator; import android.accounts.Account; import android.accounts.AccountAuthenticatorResponse; @@ -37,7 +37,7 @@ import android.text.TextUtils; import android.util.Log; -import com.github.mobile.DefaultClient; +import com.github.pockethub.DefaultClient; import java.io.IOException; import java.util.Arrays; diff --git a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticatorService.java b/app/src/main/java/com/github/pockethub/accounts/AccountAuthenticatorService.java similarity index 97% rename from app/src/main/java/com/github/mobile/accounts/AccountAuthenticatorService.java rename to app/src/main/java/com/github/pockethub/accounts/AccountAuthenticatorService.java index 569aa62b9..978472b8a 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountAuthenticatorService.java +++ b/app/src/main/java/com/github/pockethub/accounts/AccountAuthenticatorService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import static android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT; import android.app.Service; diff --git a/app/src/main/java/com/github/mobile/accounts/AccountClient.java b/app/src/main/java/com/github/pockethub/accounts/AccountClient.java similarity index 95% rename from app/src/main/java/com/github/mobile/accounts/AccountClient.java rename to app/src/main/java/com/github/pockethub/accounts/AccountClient.java index fa8d5fade..4e7b06b46 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountClient.java +++ b/app/src/main/java/com/github/pockethub/accounts/AccountClient.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import static android.util.Log.DEBUG; import android.text.TextUtils; import android.util.Log; -import com.github.mobile.DefaultClient; +import com.github.pockethub.DefaultClient; import com.google.inject.Provider; import java.net.HttpURLConnection; diff --git a/app/src/main/java/com/github/mobile/accounts/AccountConstants.java b/app/src/main/java/com/github/pockethub/accounts/AccountConstants.java similarity index 96% rename from app/src/main/java/com/github/mobile/accounts/AccountConstants.java rename to app/src/main/java/com/github/pockethub/accounts/AccountConstants.java index 9d514da37..9a061fa37 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountConstants.java +++ b/app/src/main/java/com/github/pockethub/accounts/AccountConstants.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; /** * Authentication constants diff --git a/app/src/main/java/com/github/mobile/accounts/AccountScope.java b/app/src/main/java/com/github/pockethub/accounts/AccountScope.java similarity index 98% rename from app/src/main/java/com/github/mobile/accounts/AccountScope.java rename to app/src/main/java/com/github/pockethub/accounts/AccountScope.java index 1c52aca97..954a3a3a2 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountScope.java +++ b/app/src/main/java/com/github/pockethub/accounts/AccountScope.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import android.accounts.Account; import android.accounts.AccountManager; diff --git a/app/src/main/java/com/github/mobile/accounts/AccountUtils.java b/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/accounts/AccountUtils.java rename to app/src/main/java/com/github/pockethub/accounts/AccountUtils.java index 7e4426ccb..c67b2e11e 100644 --- a/app/src/main/java/com/github/mobile/accounts/AccountUtils.java +++ b/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import static android.accounts.AccountManager.KEY_ACCOUNT_NAME; import static android.content.DialogInterface.BUTTON_POSITIVE; import static android.util.Log.DEBUG; -import static com.github.mobile.accounts.AccountConstants.ACCOUNT_TYPE; +import static com.github.pockethub.accounts.AccountConstants.ACCOUNT_TYPE; import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; import android.accounts.Account; import android.accounts.AccountManager; @@ -37,8 +37,8 @@ import android.text.TextUtils; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.LightAlertDialog; +import com.github.pockethub.R; +import com.github.pockethub.ui.LightAlertDialog; import java.io.IOException; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/accounts/AuthenticatedUserLoader.java b/app/src/main/java/com/github/pockethub/accounts/AuthenticatedUserLoader.java similarity index 98% rename from app/src/main/java/com/github/mobile/accounts/AuthenticatedUserLoader.java rename to app/src/main/java/com/github/pockethub/accounts/AuthenticatedUserLoader.java index 38224274f..fd3cb1976 100644 --- a/app/src/main/java/com/github/mobile/accounts/AuthenticatedUserLoader.java +++ b/app/src/main/java/com/github/pockethub/accounts/AuthenticatedUserLoader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import android.accounts.Account; import android.accounts.AccountManager; diff --git a/app/src/main/java/com/github/mobile/accounts/AuthenticatedUserTask.java b/app/src/main/java/com/github/pockethub/accounts/AuthenticatedUserTask.java similarity index 98% rename from app/src/main/java/com/github/mobile/accounts/AuthenticatedUserTask.java rename to app/src/main/java/com/github/pockethub/accounts/AuthenticatedUserTask.java index 93b5ca0ae..cc2a5a86f 100644 --- a/app/src/main/java/com/github/mobile/accounts/AuthenticatedUserTask.java +++ b/app/src/main/java/com/github/pockethub/accounts/AuthenticatedUserTask.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import android.accounts.Account; import android.accounts.AccountManager; diff --git a/app/src/main/java/com/github/mobile/accounts/GitHubAccount.java b/app/src/main/java/com/github/pockethub/accounts/GitHubAccount.java similarity index 95% rename from app/src/main/java/com/github/mobile/accounts/GitHubAccount.java rename to app/src/main/java/com/github/pockethub/accounts/GitHubAccount.java index 03ebbef61..aaa7cbe73 100644 --- a/app/src/main/java/com/github/mobile/accounts/GitHubAccount.java +++ b/app/src/main/java/com/github/pockethub/accounts/GitHubAccount.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import static android.accounts.AccountManager.KEY_AUTHTOKEN; -import static com.github.mobile.accounts.AccountConstants.ACCOUNT_TYPE; +import static com.github.pockethub.accounts.AccountConstants.ACCOUNT_TYPE; import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountManagerFuture; diff --git a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java b/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java similarity index 95% rename from app/src/main/java/com/github/mobile/accounts/LoginActivity.java rename to app/src/main/java/com/github/pockethub/accounts/LoginActivity.java index 1b79f8763..42955ef23 100644 --- a/app/src/main/java/com/github/mobile/accounts/LoginActivity.java +++ b/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; -import static com.github.mobile.accounts.AccountConstants.PROVIDER_AUTHORITY; +import static com.github.pockethub.accounts.AccountConstants.PROVIDER_AUTHORITY; import android.accounts.Account; import android.accounts.AccountManager; import android.app.AlertDialog; @@ -37,11 +37,11 @@ import com.alorma.github.sdk.security.GitHub; import com.alorma.github.sdk.services.login.RequestTokenClient; import com.alorma.github.sdk.services.user.GetAuthUserClient; -import com.github.mobile.R; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.ui.LightProgressDialog; -import com.github.mobile.ui.MainActivity; -import com.github.mobile.ui.roboactivities.RoboActionBarAccountAuthenticatorActivity; +import com.github.pockethub.R; +import com.github.pockethub.persistence.AccountDataManager; +import com.github.pockethub.ui.LightProgressDialog; +import com.github.pockethub.ui.MainActivity; +import com.github.pockethub.ui.roboactivities.RoboActionBarAccountAuthenticatorActivity; import com.google.inject.Inject; import com.squareup.okhttp.HttpUrl; diff --git a/app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java b/app/src/main/java/com/github/pockethub/accounts/LoginWebViewActivity.java similarity index 91% rename from app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java rename to app/src/main/java/com/github/pockethub/accounts/LoginWebViewActivity.java index ec37c98f1..a4c446e12 100644 --- a/app/src/main/java/com/github/mobile/accounts/LoginWebViewActivity.java +++ b/app/src/main/java/com/github/pockethub/accounts/LoginWebViewActivity.java @@ -1,4 +1,4 @@ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import android.content.Intent; import android.net.Uri; @@ -6,8 +6,8 @@ import android.support.v7.app.AppCompatActivity; import android.webkit.WebViewClient; -import com.github.mobile.R; -import com.github.mobile.ui.WebView; +import com.github.pockethub.R; +import com.github.pockethub.ui.WebView; public class LoginWebViewActivity extends AppCompatActivity { diff --git a/app/src/main/java/com/github/mobile/accounts/ScopeBase.java b/app/src/main/java/com/github/pockethub/accounts/ScopeBase.java similarity index 98% rename from app/src/main/java/com/github/mobile/accounts/ScopeBase.java rename to app/src/main/java/com/github/pockethub/accounts/ScopeBase.java index c678185aa..e78de6f81 100644 --- a/app/src/main/java/com/github/mobile/accounts/ScopeBase.java +++ b/app/src/main/java/com/github/pockethub/accounts/ScopeBase.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import com.google.inject.Key; import com.google.inject.Provider; diff --git a/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthActivity.java b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthActivity.java similarity index 95% rename from app/src/main/java/com/github/mobile/accounts/TwoFactorAuthActivity.java rename to app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthActivity.java index 2c3e4623d..dc9becb97 100644 --- a/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthActivity.java +++ b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthActivity.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import static android.content.DialogInterface.OnCancelListener; import static android.view.KeyEvent.ACTION_DOWN; import static android.view.KeyEvent.KEYCODE_ENTER; import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE; -import static com.github.mobile.accounts.AccountConstants.ACCOUNT_TYPE; -import static com.github.mobile.accounts.LoginActivity.configureSyncFor; +import static com.github.pockethub.accounts.AccountConstants.ACCOUNT_TYPE; +import static com.github.pockethub.accounts.LoginActivity.configureSyncFor; import android.accounts.Account; import android.accounts.AccountManager; import android.app.AlertDialog; @@ -42,10 +42,10 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.ViewFinder; -import com.github.mobile.R; -import com.github.mobile.ui.LightProgressDialog; -import com.github.mobile.ui.TextWatcherAdapter; -import com.github.mobile.ui.roboactivities.RoboActionBarActivity; +import com.github.pockethub.R; +import com.github.pockethub.ui.LightProgressDialog; +import com.github.pockethub.ui.TextWatcherAdapter; +import com.github.pockethub.ui.roboactivities.RoboActionBarActivity; import java.io.IOException; diff --git a/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthClient.java b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthClient.java similarity index 98% rename from app/src/main/java/com/github/mobile/accounts/TwoFactorAuthClient.java rename to app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthClient.java index 11884a4e3..31aa7a2c6 100644 --- a/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthClient.java +++ b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthClient.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import android.text.TextUtils; -import com.github.mobile.DefaultClient; +import com.github.pockethub.DefaultClient; import org.eclipse.egit.github.core.client.GitHubClient; import org.eclipse.egit.github.core.client.GitHubRequest; import org.eclipse.egit.github.core.client.GitHubResponse; diff --git a/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthException.java b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthException.java similarity index 97% rename from app/src/main/java/com/github/mobile/accounts/TwoFactorAuthException.java rename to app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthException.java index 580e9f031..237525cd7 100644 --- a/app/src/main/java/com/github/mobile/accounts/TwoFactorAuthException.java +++ b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.accounts; +package com.github.pockethub.accounts; import java.io.IOException; diff --git a/app/src/main/java/com/github/mobile/api/GitHubClientV2.java b/app/src/main/java/com/github/pockethub/api/GitHubClientV2.java similarity index 96% rename from app/src/main/java/com/github/mobile/api/GitHubClientV2.java rename to app/src/main/java/com/github/pockethub/api/GitHubClientV2.java index 161fc55c3..5e0dbefc9 100644 --- a/app/src/main/java/com/github/mobile/api/GitHubClientV2.java +++ b/app/src/main/java/com/github/pockethub/api/GitHubClientV2.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package com.github.mobile.api; +package com.github.pockethub.api; -import com.github.mobile.model.Authorization; +import com.github.pockethub.model.Authorization; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/core/ItemStore.java b/app/src/main/java/com/github/pockethub/core/ItemStore.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/ItemStore.java rename to app/src/main/java/com/github/pockethub/core/ItemStore.java index 74139d6d0..99bdd009d 100644 --- a/app/src/main/java/com/github/mobile/core/ItemStore.java +++ b/app/src/main/java/com/github/pockethub/core/ItemStore.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core; +package com.github.pockethub.core; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; diff --git a/app/src/main/java/com/github/mobile/core/OnLoadListener.java b/app/src/main/java/com/github/pockethub/core/OnLoadListener.java similarity index 95% rename from app/src/main/java/com/github/mobile/core/OnLoadListener.java rename to app/src/main/java/com/github/pockethub/core/OnLoadListener.java index b43a0f029..c07b8089a 100644 --- a/app/src/main/java/com/github/mobile/core/OnLoadListener.java +++ b/app/src/main/java/com/github/pockethub/core/OnLoadListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core; +package com.github.pockethub.core; /** * Load listener callback diff --git a/app/src/main/java/com/github/mobile/core/ResourcePager.java b/app/src/main/java/com/github/pockethub/core/ResourcePager.java similarity index 99% rename from app/src/main/java/com/github/mobile/core/ResourcePager.java rename to app/src/main/java/com/github/pockethub/core/ResourcePager.java index 8ae0866a6..c7b14ea1d 100644 --- a/app/src/main/java/com/github/mobile/core/ResourcePager.java +++ b/app/src/main/java/com/github/pockethub/core/ResourcePager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core; +package com.github.pockethub.core; import java.io.IOException; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/core/UrlMatcher.java b/app/src/main/java/com/github/pockethub/core/UrlMatcher.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/UrlMatcher.java rename to app/src/main/java/com/github/pockethub/core/UrlMatcher.java index eab3cd63f..9ee2ebd4d 100644 --- a/app/src/main/java/com/github/mobile/core/UrlMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/UrlMatcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core; +package com.github.pockethub.core; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/core/code/FullTree.java b/app/src/main/java/com/github/pockethub/core/code/FullTree.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/code/FullTree.java rename to app/src/main/java/com/github/pockethub/core/code/FullTree.java index f8bc7d934..0f741d75d 100644 --- a/app/src/main/java/com/github/mobile/core/code/FullTree.java +++ b/app/src/main/java/com/github/pockethub/core/code/FullTree.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.code; +package com.github.pockethub.core.code; import static java.lang.String.CASE_INSENSITIVE_ORDER; import static org.eclipse.egit.github.core.TreeEntry.TYPE_BLOB; import static org.eclipse.egit.github.core.TreeEntry.TYPE_TREE; import android.text.TextUtils; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.core.ref.RefUtils; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.core.ref.RefUtils; import java.util.List; import java.util.Map; diff --git a/app/src/main/java/com/github/mobile/core/code/RefreshBlobTask.java b/app/src/main/java/com/github/pockethub/core/code/RefreshBlobTask.java similarity index 93% rename from app/src/main/java/com/github/mobile/core/code/RefreshBlobTask.java rename to app/src/main/java/com/github/pockethub/core/code/RefreshBlobTask.java index a71213f23..c4084013c 100644 --- a/app/src/main/java/com/github/mobile/core/code/RefreshBlobTask.java +++ b/app/src/main/java/com/github/pockethub/core/code/RefreshBlobTask.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.code; +package com.github.pockethub.core.code; import android.accounts.Account; import android.content.Context; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.accounts.AuthenticatedUserTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.Blob; diff --git a/app/src/main/java/com/github/mobile/core/code/RefreshTreeTask.java b/app/src/main/java/com/github/pockethub/core/code/RefreshTreeTask.java similarity index 95% rename from app/src/main/java/com/github/mobile/core/code/RefreshTreeTask.java rename to app/src/main/java/com/github/pockethub/core/code/RefreshTreeTask.java index 723372cfc..a27468d70 100644 --- a/app/src/main/java/com/github/mobile/core/code/RefreshTreeTask.java +++ b/app/src/main/java/com/github/pockethub/core/code/RefreshTreeTask.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.code; +package com.github.pockethub.core.code; import android.accounts.Account; import android.content.Context; import android.text.TextUtils; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; -import com.github.mobile.core.ref.RefUtils; +import com.github.pockethub.accounts.AuthenticatedUserTask; +import com.github.pockethub.core.ref.RefUtils; import com.google.inject.Inject; import java.io.IOException; diff --git a/app/src/main/java/com/github/mobile/core/commit/CommitCompareTask.java b/app/src/main/java/com/github/pockethub/core/commit/CommitCompareTask.java similarity index 95% rename from app/src/main/java/com/github/mobile/core/commit/CommitCompareTask.java rename to app/src/main/java/com/github/pockethub/core/commit/CommitCompareTask.java index 933cd672a..1518aa50c 100644 --- a/app/src/main/java/com/github/mobile/core/commit/CommitCompareTask.java +++ b/app/src/main/java/com/github/pockethub/core/commit/CommitCompareTask.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.accounts.AuthenticatedUserTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/core/commit/CommitMatch.java b/app/src/main/java/com/github/pockethub/core/commit/CommitMatch.java similarity index 96% rename from app/src/main/java/com/github/mobile/core/commit/CommitMatch.java rename to app/src/main/java/com/github/pockethub/core/commit/CommitMatch.java index 4a4dfe995..d71debe99 100644 --- a/app/src/main/java/com/github/mobile/core/commit/CommitMatch.java +++ b/app/src/main/java/com/github/pockethub/core/commit/CommitMatch.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/main/java/com/github/mobile/core/commit/CommitPager.java b/app/src/main/java/com/github/pockethub/core/commit/CommitPager.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/commit/CommitPager.java rename to app/src/main/java/com/github/pockethub/core/commit/CommitPager.java index f50ef9847..dcf157315 100644 --- a/app/src/main/java/com/github/mobile/core/commit/CommitPager.java +++ b/app/src/main/java/com/github/pockethub/core/commit/CommitPager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.core.ResourcePager; import org.eclipse.egit.github.core.IRepositoryIdProvider; import org.eclipse.egit.github.core.RepositoryCommit; diff --git a/app/src/main/java/com/github/mobile/core/commit/CommitStore.java b/app/src/main/java/com/github/pockethub/core/commit/CommitStore.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/commit/CommitStore.java rename to app/src/main/java/com/github/pockethub/core/commit/CommitStore.java index 689796085..c2247459a 100644 --- a/app/src/main/java/com/github/mobile/core/commit/CommitStore.java +++ b/app/src/main/java/com/github/pockethub/core/commit/CommitStore.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; -import com.github.mobile.core.ItemStore; +import com.github.pockethub.core.ItemStore; import java.io.IOException; import java.util.HashMap; diff --git a/app/src/main/java/com/github/mobile/core/commit/CommitUriMatcher.java b/app/src/main/java/com/github/pockethub/core/commit/CommitUriMatcher.java similarity index 95% rename from app/src/main/java/com/github/mobile/core/commit/CommitUriMatcher.java rename to app/src/main/java/com/github/pockethub/core/commit/CommitUriMatcher.java index b49411d6b..c7568e915 100644 --- a/app/src/main/java/com/github/mobile/core/commit/CommitUriMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/commit/CommitUriMatcher.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; import android.net.Uri; -import com.github.mobile.core.repo.RepositoryUtils; +import com.github.pockethub.core.repo.RepositoryUtils; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/core/commit/CommitUtils.java b/app/src/main/java/com/github/pockethub/core/commit/CommitUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/commit/CommitUtils.java rename to app/src/main/java/com/github/pockethub/core/commit/CommitUtils.java index 1afba8cf4..ec8c52ba2 100644 --- a/app/src/main/java/com/github/mobile/core/commit/CommitUtils.java +++ b/app/src/main/java/com/github/pockethub/core/commit/CommitUtils.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; import android.text.TextUtils; import android.widget.ImageView; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.AvatarLoader; import java.text.NumberFormat; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/core/commit/FullCommit.java b/app/src/main/java/com/github/pockethub/core/commit/FullCommit.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/commit/FullCommit.java rename to app/src/main/java/com/github/pockethub/core/commit/FullCommit.java index 2a0b4e305..aeb09e2ce 100644 --- a/app/src/main/java/com/github/mobile/core/commit/FullCommit.java +++ b/app/src/main/java/com/github/pockethub/core/commit/FullCommit.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/core/commit/FullCommitFile.java b/app/src/main/java/com/github/pockethub/core/commit/FullCommitFile.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/commit/FullCommitFile.java rename to app/src/main/java/com/github/pockethub/core/commit/FullCommitFile.java index ec0db2bb4..daf3353df 100644 --- a/app/src/main/java/com/github/mobile/core/commit/FullCommitFile.java +++ b/app/src/main/java/com/github/pockethub/core/commit/FullCommitFile.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; import android.util.SparseArray; diff --git a/app/src/main/java/com/github/mobile/core/commit/RefreshCommitTask.java b/app/src/main/java/com/github/pockethub/core/commit/RefreshCommitTask.java similarity index 93% rename from app/src/main/java/com/github/mobile/core/commit/RefreshCommitTask.java rename to app/src/main/java/com/github/pockethub/core/commit/RefreshCommitTask.java index d916eb46d..f78769953 100644 --- a/app/src/main/java/com/github/mobile/core/commit/RefreshCommitTask.java +++ b/app/src/main/java/com/github/pockethub/core/commit/RefreshCommitTask.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.commit; +package com.github.pockethub.core.commit; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; -import com.github.mobile.util.HtmlUtils; -import com.github.mobile.util.HttpImageGetter; +import com.github.pockethub.accounts.AuthenticatedUserTask; +import com.github.pockethub.util.HtmlUtils; +import com.github.pockethub.util.HttpImageGetter; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/core/gist/FullGist.java b/app/src/main/java/com/github/pockethub/core/gist/FullGist.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/gist/FullGist.java rename to app/src/main/java/com/github/pockethub/core/gist/FullGist.java index c72af8888..464776531 100644 --- a/app/src/main/java/com/github/mobile/core/gist/FullGist.java +++ b/app/src/main/java/com/github/pockethub/core/gist/FullGist.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.gist; +package com.github.pockethub.core.gist; import java.io.Serializable; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/core/gist/GistEventMatcher.java b/app/src/main/java/com/github/pockethub/core/gist/GistEventMatcher.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/gist/GistEventMatcher.java rename to app/src/main/java/com/github/pockethub/core/gist/GistEventMatcher.java index 1946da67c..f7bff1b25 100644 --- a/app/src/main/java/com/github/mobile/core/gist/GistEventMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/gist/GistEventMatcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.gist; +package com.github.pockethub.core.gist; import static org.eclipse.egit.github.core.event.Event.TYPE_GIST; diff --git a/app/src/main/java/com/github/mobile/core/gist/GistPager.java b/app/src/main/java/com/github/pockethub/core/gist/GistPager.java similarity index 92% rename from app/src/main/java/com/github/mobile/core/gist/GistPager.java rename to app/src/main/java/com/github/pockethub/core/gist/GistPager.java index 3e7c43c3e..5892d7d0e 100644 --- a/app/src/main/java/com/github/mobile/core/gist/GistPager.java +++ b/app/src/main/java/com/github/pockethub/core/gist/GistPager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.gist; +package com.github.pockethub.core.gist; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.core.ResourcePager; import org.eclipse.egit.github.core.Gist; diff --git a/app/src/main/java/com/github/mobile/core/gist/GistStore.java b/app/src/main/java/com/github/pockethub/core/gist/GistStore.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/gist/GistStore.java rename to app/src/main/java/com/github/pockethub/core/gist/GistStore.java index 11469f1e3..cd5b99233 100644 --- a/app/src/main/java/com/github/mobile/core/gist/GistStore.java +++ b/app/src/main/java/com/github/pockethub/core/gist/GistStore.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.gist; +package com.github.pockethub.core.gist; import static java.lang.String.CASE_INSENSITIVE_ORDER; -import com.github.mobile.core.ItemStore; +import com.github.pockethub.core.ItemStore; import java.io.IOException; import java.util.Map; diff --git a/app/src/main/java/com/github/mobile/core/gist/GistUriMatcher.java b/app/src/main/java/com/github/pockethub/core/gist/GistUriMatcher.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/gist/GistUriMatcher.java rename to app/src/main/java/com/github/pockethub/core/gist/GistUriMatcher.java index a1e181e16..abb7ec204 100644 --- a/app/src/main/java/com/github/mobile/core/gist/GistUriMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/gist/GistUriMatcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.gist; +package com.github.pockethub.core.gist; import android.net.Uri; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/core/gist/RefreshGistTask.java b/app/src/main/java/com/github/pockethub/core/gist/RefreshGistTask.java similarity index 92% rename from app/src/main/java/com/github/mobile/core/gist/RefreshGistTask.java rename to app/src/main/java/com/github/pockethub/core/gist/RefreshGistTask.java index b4ffee560..3beaa21ad 100644 --- a/app/src/main/java/com/github/mobile/core/gist/RefreshGistTask.java +++ b/app/src/main/java/com/github/pockethub/core/gist/RefreshGistTask.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.gist; +package com.github.pockethub.core.gist; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; -import com.github.mobile.util.HtmlUtils; -import com.github.mobile.util.HttpImageGetter; +import com.github.pockethub.accounts.AuthenticatedUserTask; +import com.github.pockethub.util.HtmlUtils; +import com.github.pockethub.util.HttpImageGetter; import com.google.inject.Inject; import java.util.Collections; diff --git a/app/src/main/java/com/github/mobile/core/gist/StarGistTask.java b/app/src/main/java/com/github/pockethub/core/gist/StarGistTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/gist/StarGistTask.java rename to app/src/main/java/com/github/pockethub/core/gist/StarGistTask.java index ce2de2936..f318c1529 100644 --- a/app/src/main/java/com/github/mobile/core/gist/StarGistTask.java +++ b/app/src/main/java/com/github/pockethub/core/gist/StarGistTask.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.gist; +package com.github.pockethub.core.gist; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.accounts.AuthenticatedUserTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.Gist; diff --git a/app/src/main/java/com/github/mobile/core/gist/UnstarGistTask.java b/app/src/main/java/com/github/pockethub/core/gist/UnstarGistTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/gist/UnstarGistTask.java rename to app/src/main/java/com/github/pockethub/core/gist/UnstarGistTask.java index e124b0406..b1ab9fa20 100644 --- a/app/src/main/java/com/github/mobile/core/gist/UnstarGistTask.java +++ b/app/src/main/java/com/github/pockethub/core/gist/UnstarGistTask.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.gist; +package com.github.pockethub.core.gist; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.accounts.AuthenticatedUserTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.Gist; diff --git a/app/src/main/java/com/github/mobile/core/issue/FullIssue.java b/app/src/main/java/com/github/pockethub/core/issue/FullIssue.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/issue/FullIssue.java rename to app/src/main/java/com/github/pockethub/core/issue/FullIssue.java index 128960f81..875233e2b 100644 --- a/app/src/main/java/com/github/mobile/core/issue/FullIssue.java +++ b/app/src/main/java/com/github/pockethub/core/issue/FullIssue.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.issue; +package com.github.pockethub.core.issue; import java.io.Serializable; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/core/issue/IssueEventMatcher.java b/app/src/main/java/com/github/pockethub/core/issue/IssueEventMatcher.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/issue/IssueEventMatcher.java rename to app/src/main/java/com/github/pockethub/core/issue/IssueEventMatcher.java index 0e3b020a6..74e4e6db9 100644 --- a/app/src/main/java/com/github/mobile/core/issue/IssueEventMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/issue/IssueEventMatcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.issue; +package com.github.pockethub.core.issue; import static org.eclipse.egit.github.core.event.Event.TYPE_ISSUES; import static org.eclipse.egit.github.core.event.Event.TYPE_ISSUE_COMMENT; diff --git a/app/src/main/java/com/github/mobile/core/issue/IssueFilter.java b/app/src/main/java/com/github/pockethub/core/issue/IssueFilter.java similarity index 99% rename from app/src/main/java/com/github/mobile/core/issue/IssueFilter.java rename to app/src/main/java/com/github/pockethub/core/issue/IssueFilter.java index 4eabbe6a2..7541e1ef4 100644 --- a/app/src/main/java/com/github/mobile/core/issue/IssueFilter.java +++ b/app/src/main/java/com/github/pockethub/core/issue/IssueFilter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.issue; +package com.github.pockethub.core.issue; import static java.lang.String.CASE_INSENSITIVE_ORDER; import static org.eclipse.egit.github.core.service.IssueService.DIRECTION_DESCENDING; diff --git a/app/src/main/java/com/github/mobile/core/issue/IssuePager.java b/app/src/main/java/com/github/pockethub/core/issue/IssuePager.java similarity index 93% rename from app/src/main/java/com/github/mobile/core/issue/IssuePager.java rename to app/src/main/java/com/github/pockethub/core/issue/IssuePager.java index 0d4fba135..9a59c19b1 100644 --- a/app/src/main/java/com/github/mobile/core/issue/IssuePager.java +++ b/app/src/main/java/com/github/pockethub/core/issue/IssuePager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.issue; +package com.github.pockethub.core.issue; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.core.ResourcePager; import org.eclipse.egit.github.core.Issue; diff --git a/app/src/main/java/com/github/mobile/core/issue/IssueStore.java b/app/src/main/java/com/github/pockethub/core/issue/IssueStore.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/issue/IssueStore.java rename to app/src/main/java/com/github/pockethub/core/issue/IssueStore.java index 5669fd406..51d50d833 100644 --- a/app/src/main/java/com/github/mobile/core/issue/IssueStore.java +++ b/app/src/main/java/com/github/pockethub/core/issue/IssueStore.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.issue; +package com.github.pockethub.core.issue; -import com.github.mobile.core.ItemStore; -import com.github.mobile.util.HtmlUtils; +import com.github.pockethub.core.ItemStore; +import com.github.pockethub.util.HtmlUtils; import java.io.IOException; import java.util.HashMap; diff --git a/app/src/main/java/com/github/mobile/core/issue/IssueUriMatcher.java b/app/src/main/java/com/github/pockethub/core/issue/IssueUriMatcher.java similarity index 96% rename from app/src/main/java/com/github/mobile/core/issue/IssueUriMatcher.java rename to app/src/main/java/com/github/pockethub/core/issue/IssueUriMatcher.java index 2b330f9f8..06442e3e9 100644 --- a/app/src/main/java/com/github/mobile/core/issue/IssueUriMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/issue/IssueUriMatcher.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.issue; +package com.github.pockethub.core.issue; import android.net.Uri; import android.text.TextUtils; -import com.github.mobile.core.repo.RepositoryUtils; +import com.github.pockethub.core.repo.RepositoryUtils; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/core/issue/IssueUtils.java b/app/src/main/java/com/github/pockethub/core/issue/IssueUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/issue/IssueUtils.java rename to app/src/main/java/com/github/pockethub/core/issue/IssueUtils.java index 95b9dd664..d171cc461 100644 --- a/app/src/main/java/com/github/mobile/core/issue/IssueUtils.java +++ b/app/src/main/java/com/github/pockethub/core/issue/IssueUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.issue; +package com.github.pockethub.core.issue; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/core/issue/RefreshIssueTask.java b/app/src/main/java/com/github/pockethub/core/issue/RefreshIssueTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/issue/RefreshIssueTask.java rename to app/src/main/java/com/github/pockethub/core/issue/RefreshIssueTask.java index d2195feeb..78beb427e 100644 --- a/app/src/main/java/com/github/mobile/core/issue/RefreshIssueTask.java +++ b/app/src/main/java/com/github/pockethub/core/issue/RefreshIssueTask.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.issue; +package com.github.pockethub.core.issue; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; -import com.github.mobile.util.HtmlUtils; -import com.github.mobile.util.HttpImageGetter; +import com.github.pockethub.accounts.AuthenticatedUserTask; +import com.github.pockethub.util.HtmlUtils; +import com.github.pockethub.util.HttpImageGetter; import com.google.inject.Inject; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/core/ref/RefUtils.java b/app/src/main/java/com/github/pockethub/core/ref/RefUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/ref/RefUtils.java rename to app/src/main/java/com/github/pockethub/core/ref/RefUtils.java index 284d5d00b..187118b7f 100644 --- a/app/src/main/java/com/github/mobile/core/ref/RefUtils.java +++ b/app/src/main/java/com/github/pockethub/core/ref/RefUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.ref; +package com.github.pockethub.core.ref; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/core/repo/DeleteRepositoryTask.java b/app/src/main/java/com/github/pockethub/core/repo/DeleteRepositoryTask.java similarity index 92% rename from app/src/main/java/com/github/mobile/core/repo/DeleteRepositoryTask.java rename to app/src/main/java/com/github/pockethub/core/repo/DeleteRepositoryTask.java index f93a1c1b8..6e9adb989 100644 --- a/app/src/main/java/com/github/mobile/core/repo/DeleteRepositoryTask.java +++ b/app/src/main/java/com/github/pockethub/core/repo/DeleteRepositoryTask.java @@ -1,18 +1,17 @@ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.accounts.AccountAuthenticator; -import com.github.mobile.api.GitHubClientV2; -import com.github.mobile.model.Authorization; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AccountAuthenticator; +import com.github.pockethub.api.GitHubClientV2; +import com.github.pockethub.model.Authorization; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; -import java.util.Arrays; import java.util.Collections; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/core/repo/ForkRepositoryTask.java b/app/src/main/java/com/github/pockethub/core/repo/ForkRepositoryTask.java similarity index 91% rename from app/src/main/java/com/github/mobile/core/repo/ForkRepositoryTask.java rename to app/src/main/java/com/github/pockethub/core/repo/ForkRepositoryTask.java index a894eb18e..2ccfc1a8a 100644 --- a/app/src/main/java/com/github/mobile/core/repo/ForkRepositoryTask.java +++ b/app/src/main/java/com/github/pockethub/core/repo/ForkRepositoryTask.java @@ -1,11 +1,11 @@ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/core/repo/RefreshRepositoryTask.java b/app/src/main/java/com/github/pockethub/core/repo/RefreshRepositoryTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/repo/RefreshRepositoryTask.java rename to app/src/main/java/com/github/pockethub/core/repo/RefreshRepositoryTask.java index b12b5c493..397dc36e1 100644 --- a/app/src/main/java/com/github/mobile/core/repo/RefreshRepositoryTask.java +++ b/app/src/main/java/com/github/pockethub/core/repo/RefreshRepositoryTask.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/core/repo/RepositoryEventMatcher.java b/app/src/main/java/com/github/pockethub/core/repo/RepositoryEventMatcher.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/repo/RepositoryEventMatcher.java rename to app/src/main/java/com/github/pockethub/core/repo/RepositoryEventMatcher.java index 8b91be530..5ffaeff76 100644 --- a/app/src/main/java/com/github/mobile/core/repo/RepositoryEventMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/repo/RepositoryEventMatcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import static org.eclipse.egit.github.core.event.Event.TYPE_CREATE; import static org.eclipse.egit.github.core.event.Event.TYPE_FORK; diff --git a/app/src/main/java/com/github/mobile/core/repo/RepositoryUriMatcher.java b/app/src/main/java/com/github/pockethub/core/repo/RepositoryUriMatcher.java similarity index 97% rename from app/src/main/java/com/github/mobile/core/repo/RepositoryUriMatcher.java rename to app/src/main/java/com/github/pockethub/core/repo/RepositoryUriMatcher.java index 94cdc06aa..c01291557 100644 --- a/app/src/main/java/com/github/mobile/core/repo/RepositoryUriMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/repo/RepositoryUriMatcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import android.net.Uri; diff --git a/app/src/main/java/com/github/mobile/core/repo/RepositoryUtils.java b/app/src/main/java/com/github/pockethub/core/repo/RepositoryUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/repo/RepositoryUtils.java rename to app/src/main/java/com/github/pockethub/core/repo/RepositoryUtils.java index d367adaa6..62577ad81 100644 --- a/app/src/main/java/com/github/mobile/core/repo/RepositoryUtils.java +++ b/app/src/main/java/com/github/pockethub/core/repo/RepositoryUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/core/repo/StarRepositoryTask.java b/app/src/main/java/com/github/pockethub/core/repo/StarRepositoryTask.java similarity index 93% rename from app/src/main/java/com/github/mobile/core/repo/StarRepositoryTask.java rename to app/src/main/java/com/github/pockethub/core/repo/StarRepositoryTask.java index 598a51509..e632d2838 100644 --- a/app/src/main/java/com/github/mobile/core/repo/StarRepositoryTask.java +++ b/app/src/main/java/com/github/pockethub/core/repo/StarRepositoryTask.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/core/repo/StarredRepositoryTask.java b/app/src/main/java/com/github/pockethub/core/repo/StarredRepositoryTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/repo/StarredRepositoryTask.java rename to app/src/main/java/com/github/pockethub/core/repo/StarredRepositoryTask.java index 96e0c90b4..5b68f9a47 100644 --- a/app/src/main/java/com/github/mobile/core/repo/StarredRepositoryTask.java +++ b/app/src/main/java/com/github/pockethub/core/repo/StarredRepositoryTask.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import org.eclipse.egit.github.core.IRepositoryIdProvider; import org.eclipse.egit.github.core.service.WatcherService; @@ -22,7 +22,7 @@ import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.accounts.AuthenticatedUserTask; import com.google.inject.Inject; /** diff --git a/app/src/main/java/com/github/mobile/core/repo/UnstarRepositoryTask.java b/app/src/main/java/com/github/pockethub/core/repo/UnstarRepositoryTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/repo/UnstarRepositoryTask.java rename to app/src/main/java/com/github/pockethub/core/repo/UnstarRepositoryTask.java index c0f285220..c394ff973 100644 --- a/app/src/main/java/com/github/mobile/core/repo/UnstarRepositoryTask.java +++ b/app/src/main/java/com/github/pockethub/core/repo/UnstarRepositoryTask.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.repo; +package com.github.pockethub.core.repo; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/core/search/SearchUser.java b/app/src/main/java/com/github/pockethub/core/search/SearchUser.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/search/SearchUser.java rename to app/src/main/java/com/github/pockethub/core/search/SearchUser.java index 69d8855c7..db19c181f 100644 --- a/app/src/main/java/com/github/mobile/core/search/SearchUser.java +++ b/app/src/main/java/com/github/pockethub/core/search/SearchUser.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.search; +package com.github.pockethub.core.search; import java.io.Serializable; import java.util.Date; diff --git a/app/src/main/java/com/github/mobile/core/search/SearchUserService.java b/app/src/main/java/com/github/pockethub/core/search/SearchUserService.java similarity index 99% rename from app/src/main/java/com/github/mobile/core/search/SearchUserService.java rename to app/src/main/java/com/github/pockethub/core/search/SearchUserService.java index 1a1d16ca0..a034096b3 100644 --- a/app/src/main/java/com/github/mobile/core/search/SearchUserService.java +++ b/app/src/main/java/com/github/pockethub/core/search/SearchUserService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.search; +package com.github.pockethub.core.search; import static org.eclipse.egit.github.core.client.IGitHubConstants.CHARSET_UTF8; import static org.eclipse.egit.github.core.client.IGitHubConstants.PARAM_START_PAGE; diff --git a/app/src/main/java/com/github/mobile/core/user/FollowUserTask.java b/app/src/main/java/com/github/pockethub/core/user/FollowUserTask.java similarity index 93% rename from app/src/main/java/com/github/mobile/core/user/FollowUserTask.java rename to app/src/main/java/com/github/pockethub/core/user/FollowUserTask.java index 7bc2f1be5..48b22ead6 100644 --- a/app/src/main/java/com/github/mobile/core/user/FollowUserTask.java +++ b/app/src/main/java/com/github/pockethub/core/user/FollowUserTask.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.user; +package com.github.pockethub.core.user; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/core/user/FollowingUserTask.java b/app/src/main/java/com/github/pockethub/core/user/FollowingUserTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/user/FollowingUserTask.java rename to app/src/main/java/com/github/pockethub/core/user/FollowingUserTask.java index d79c0dd72..2f285eda3 100644 --- a/app/src/main/java/com/github/mobile/core/user/FollowingUserTask.java +++ b/app/src/main/java/com/github/pockethub/core/user/FollowingUserTask.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.user; +package com.github.pockethub.core.user; import org.eclipse.egit.github.core.service.UserService; @@ -21,7 +21,7 @@ import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.accounts.AuthenticatedUserTask; import com.google.inject.Inject; /** diff --git a/app/src/main/java/com/github/mobile/core/user/RefreshUserTask.java b/app/src/main/java/com/github/pockethub/core/user/RefreshUserTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/user/RefreshUserTask.java rename to app/src/main/java/com/github/pockethub/core/user/RefreshUserTask.java index e3bd0267a..fed4c7f28 100644 --- a/app/src/main/java/com/github/mobile/core/user/RefreshUserTask.java +++ b/app/src/main/java/com/github/pockethub/core/user/RefreshUserTask.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.user; +package com.github.pockethub.core.user; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.accounts.AuthenticatedUserTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/core/user/UnfollowUserTask.java b/app/src/main/java/com/github/pockethub/core/user/UnfollowUserTask.java similarity index 93% rename from app/src/main/java/com/github/mobile/core/user/UnfollowUserTask.java rename to app/src/main/java/com/github/pockethub/core/user/UnfollowUserTask.java index 458a9f5af..2c93edee5 100644 --- a/app/src/main/java/com/github/mobile/core/user/UnfollowUserTask.java +++ b/app/src/main/java/com/github/pockethub/core/user/UnfollowUserTask.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.user; +package com.github.pockethub.core.user; import android.accounts.Account; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/core/user/UserComparator.java b/app/src/main/java/com/github/pockethub/core/user/UserComparator.java similarity index 94% rename from app/src/main/java/com/github/mobile/core/user/UserComparator.java rename to app/src/main/java/com/github/pockethub/core/user/UserComparator.java index adf0b359a..03e610e00 100644 --- a/app/src/main/java/com/github/mobile/core/user/UserComparator.java +++ b/app/src/main/java/com/github/pockethub/core/user/UserComparator.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.user; +package com.github.pockethub.core.user; import static java.lang.String.CASE_INSENSITIVE_ORDER; -import com.github.mobile.accounts.GitHubAccount; +import com.github.pockethub.accounts.GitHubAccount; import com.google.inject.Inject; import java.util.Comparator; diff --git a/app/src/main/java/com/github/mobile/core/user/UserEventMatcher.java b/app/src/main/java/com/github/pockethub/core/user/UserEventMatcher.java similarity index 98% rename from app/src/main/java/com/github/mobile/core/user/UserEventMatcher.java rename to app/src/main/java/com/github/pockethub/core/user/UserEventMatcher.java index 437daca3d..fb69fb58f 100644 --- a/app/src/main/java/com/github/mobile/core/user/UserEventMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/user/UserEventMatcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.user; +package com.github.pockethub.core.user; import static org.eclipse.egit.github.core.event.Event.TYPE_FOLLOW; diff --git a/app/src/main/java/com/github/mobile/core/user/UserPager.java b/app/src/main/java/com/github/pockethub/core/user/UserPager.java similarity index 90% rename from app/src/main/java/com/github/mobile/core/user/UserPager.java rename to app/src/main/java/com/github/pockethub/core/user/UserPager.java index 88b1623c4..c1721ef58 100644 --- a/app/src/main/java/com/github/mobile/core/user/UserPager.java +++ b/app/src/main/java/com/github/pockethub/core/user/UserPager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.user; +package com.github.pockethub.core.user; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.core.ResourcePager; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/core/user/UserUriMatcher.java b/app/src/main/java/com/github/pockethub/core/user/UserUriMatcher.java similarity index 93% rename from app/src/main/java/com/github/mobile/core/user/UserUriMatcher.java rename to app/src/main/java/com/github/pockethub/core/user/UserUriMatcher.java index b80129900..5528d6587 100644 --- a/app/src/main/java/com/github/mobile/core/user/UserUriMatcher.java +++ b/app/src/main/java/com/github/pockethub/core/user/UserUriMatcher.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.core.user; +package com.github.pockethub.core.user; import android.net.Uri; -import com.github.mobile.core.repo.RepositoryUtils; +import com.github.pockethub.core.repo.RepositoryUtils; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/model/App.java b/app/src/main/java/com/github/pockethub/model/App.java similarity index 97% rename from app/src/main/java/com/github/mobile/model/App.java rename to app/src/main/java/com/github/pockethub/model/App.java index d541a69d6..23ce547d9 100644 --- a/app/src/main/java/com/github/mobile/model/App.java +++ b/app/src/main/java/com/github/pockethub/model/App.java @@ -1,4 +1,4 @@ -package com.github.mobile.model; +package com.github.pockethub.model; import java.util.HashMap; import java.util.Map; diff --git a/app/src/main/java/com/github/mobile/model/Authorization.java b/app/src/main/java/com/github/pockethub/model/Authorization.java similarity index 98% rename from app/src/main/java/com/github/mobile/model/Authorization.java rename to app/src/main/java/com/github/pockethub/model/Authorization.java index 163dccc88..d11183fbb 100644 --- a/app/src/main/java/com/github/mobile/model/Authorization.java +++ b/app/src/main/java/com/github/pockethub/model/Authorization.java @@ -1,4 +1,4 @@ -package com.github.mobile.model; +package com.github.pockethub.model; import java.util.ArrayList; import java.util.HashMap; diff --git a/app/src/main/java/com/github/mobile/persistence/AccountDataManager.java b/app/src/main/java/com/github/pockethub/persistence/AccountDataManager.java similarity index 96% rename from app/src/main/java/com/github/mobile/persistence/AccountDataManager.java rename to app/src/main/java/com/github/pockethub/persistence/AccountDataManager.java index 2a2d383e2..c13d8c56e 100644 --- a/app/src/main/java/com/github/mobile/persistence/AccountDataManager.java +++ b/app/src/main/java/com/github/pockethub/persistence/AccountDataManager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.persistence; +package com.github.pockethub.persistence; import android.accounts.Account; import android.content.Context; @@ -22,12 +22,12 @@ import android.database.sqlite.SQLiteQueryBuilder; import android.util.Log; -import com.github.mobile.RequestFuture; -import com.github.mobile.RequestReader; -import com.github.mobile.RequestWriter; -import com.github.mobile.accounts.AuthenticatedUserTask; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.persistence.OrganizationRepositories.Factory; +import com.github.pockethub.RequestFuture; +import com.github.pockethub.RequestReader; +import com.github.pockethub.RequestWriter; +import com.github.pockethub.accounts.AuthenticatedUserTask; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.persistence.OrganizationRepositories.Factory; import com.google.inject.Inject; import com.google.inject.name.Named; diff --git a/app/src/main/java/com/github/mobile/persistence/CacheHelper.java b/app/src/main/java/com/github/pockethub/persistence/CacheHelper.java similarity index 97% rename from app/src/main/java/com/github/mobile/persistence/CacheHelper.java rename to app/src/main/java/com/github/pockethub/persistence/CacheHelper.java index 541f93a50..bd385496f 100644 --- a/app/src/main/java/com/github/mobile/persistence/CacheHelper.java +++ b/app/src/main/java/com/github/pockethub/persistence/CacheHelper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.persistence; +package com.github.pockethub.persistence; import android.content.Context; import android.database.sqlite.SQLiteDatabase; diff --git a/app/src/main/java/com/github/mobile/persistence/DatabaseCache.java b/app/src/main/java/com/github/pockethub/persistence/DatabaseCache.java similarity index 99% rename from app/src/main/java/com/github/mobile/persistence/DatabaseCache.java rename to app/src/main/java/com/github/pockethub/persistence/DatabaseCache.java index fb72cbcca..9b94e9096 100644 --- a/app/src/main/java/com/github/mobile/persistence/DatabaseCache.java +++ b/app/src/main/java/com/github/pockethub/persistence/DatabaseCache.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.persistence; +package com.github.pockethub.persistence; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; diff --git a/app/src/main/java/com/github/mobile/persistence/OrganizationRepositories.java b/app/src/main/java/com/github/pockethub/persistence/OrganizationRepositories.java similarity index 98% rename from app/src/main/java/com/github/mobile/persistence/OrganizationRepositories.java rename to app/src/main/java/com/github/pockethub/persistence/OrganizationRepositories.java index b5c7eb47e..f8af20161 100644 --- a/app/src/main/java/com/github/mobile/persistence/OrganizationRepositories.java +++ b/app/src/main/java/com/github/pockethub/persistence/OrganizationRepositories.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.persistence; +package com.github.pockethub.persistence; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; -import com.github.mobile.accounts.GitHubAccount; +import com.github.pockethub.accounts.GitHubAccount; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.assistedinject.Assisted; diff --git a/app/src/main/java/com/github/mobile/persistence/Organizations.java b/app/src/main/java/com/github/pockethub/persistence/Organizations.java similarity index 98% rename from app/src/main/java/com/github/mobile/persistence/Organizations.java rename to app/src/main/java/com/github/pockethub/persistence/Organizations.java index c435a3c54..f9284fdcb 100644 --- a/app/src/main/java/com/github/mobile/persistence/Organizations.java +++ b/app/src/main/java/com/github/pockethub/persistence/Organizations.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.persistence; +package com.github.pockethub.persistence; import android.content.ContentValues; import android.database.Cursor; diff --git a/app/src/main/java/com/github/mobile/persistence/PersistableResource.java b/app/src/main/java/com/github/pockethub/persistence/PersistableResource.java similarity index 97% rename from app/src/main/java/com/github/mobile/persistence/PersistableResource.java rename to app/src/main/java/com/github/pockethub/persistence/PersistableResource.java index 11d1e3718..53c3f104e 100644 --- a/app/src/main/java/com/github/mobile/persistence/PersistableResource.java +++ b/app/src/main/java/com/github/pockethub/persistence/PersistableResource.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.persistence; +package com.github.pockethub.persistence; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; diff --git a/app/src/main/java/com/github/mobile/sync/ContentProviderAdapter.java b/app/src/main/java/com/github/pockethub/sync/ContentProviderAdapter.java similarity index 97% rename from app/src/main/java/com/github/mobile/sync/ContentProviderAdapter.java rename to app/src/main/java/com/github/pockethub/sync/ContentProviderAdapter.java index 68df13001..e7b9c6727 100644 --- a/app/src/main/java/com/github/mobile/sync/ContentProviderAdapter.java +++ b/app/src/main/java/com/github/pockethub/sync/ContentProviderAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.sync; +package com.github.pockethub.sync; import android.content.ContentProvider; import android.content.ContentValues; diff --git a/app/src/main/java/com/github/mobile/sync/SyncAdapter.java b/app/src/main/java/com/github/pockethub/sync/SyncAdapter.java similarity index 94% rename from app/src/main/java/com/github/mobile/sync/SyncAdapter.java rename to app/src/main/java/com/github/pockethub/sync/SyncAdapter.java index 2b971a00d..59775b2b8 100644 --- a/app/src/main/java/com/github/mobile/sync/SyncAdapter.java +++ b/app/src/main/java/com/github/pockethub/sync/SyncAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.sync; +package com.github.pockethub.sync; import android.accounts.Account; import android.accounts.AccountManager; @@ -23,8 +23,8 @@ import android.content.SyncResult; import android.os.Bundle; -import com.github.mobile.accounts.AccountScope; -import com.github.mobile.sync.SyncCampaign.Factory; +import com.github.pockethub.accounts.AccountScope; +import com.github.pockethub.sync.SyncCampaign.Factory; import com.google.inject.Inject; import roboguice.inject.ContextScope; diff --git a/app/src/main/java/com/github/mobile/sync/SyncAdapterService.java b/app/src/main/java/com/github/pockethub/sync/SyncAdapterService.java similarity index 96% rename from app/src/main/java/com/github/mobile/sync/SyncAdapterService.java rename to app/src/main/java/com/github/pockethub/sync/SyncAdapterService.java index 2f6a1c9b2..5af070733 100644 --- a/app/src/main/java/com/github/mobile/sync/SyncAdapterService.java +++ b/app/src/main/java/com/github/pockethub/sync/SyncAdapterService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.sync; +package com.github.pockethub.sync; import android.content.Intent; import android.os.IBinder; diff --git a/app/src/main/java/com/github/mobile/sync/SyncCampaign.java b/app/src/main/java/com/github/pockethub/sync/SyncCampaign.java similarity index 93% rename from app/src/main/java/com/github/mobile/sync/SyncCampaign.java rename to app/src/main/java/com/github/pockethub/sync/SyncCampaign.java index 15991ae3a..df119603d 100644 --- a/app/src/main/java/com/github/mobile/sync/SyncCampaign.java +++ b/app/src/main/java/com/github/pockethub/sync/SyncCampaign.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.sync; +package com.github.pockethub.sync; import android.content.SyncResult; import android.database.SQLException; import android.util.Log; -import com.github.mobile.persistence.DatabaseCache; -import com.github.mobile.persistence.OrganizationRepositories; -import com.github.mobile.persistence.Organizations; +import com.github.pockethub.persistence.DatabaseCache; +import com.github.pockethub.persistence.OrganizationRepositories; +import com.github.pockethub.persistence.Organizations; import com.google.inject.Inject; import com.google.inject.assistedinject.Assisted; diff --git a/app/src/main/java/com/github/mobile/ui/BaseActivity.java b/app/src/main/java/com/github/pockethub/ui/BaseActivity.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/BaseActivity.java rename to app/src/main/java/com/github/pockethub/ui/BaseActivity.java index 5a9aef467..6e46fdf5c 100644 --- a/app/src/main/java/com/github/mobile/ui/BaseActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/BaseActivity.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.os.Bundle; import com.github.kevinsawicki.wishlist.ViewFinder; -import com.github.mobile.ui.roboactivities.RoboActionBarActivity; +import com.github.pockethub.ui.roboactivities.RoboActionBarActivity; import java.io.Serializable; diff --git a/app/src/main/java/com/github/mobile/ui/CheckableRelativeLayout.java b/app/src/main/java/com/github/pockethub/ui/CheckableRelativeLayout.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/CheckableRelativeLayout.java rename to app/src/main/java/com/github/pockethub/ui/CheckableRelativeLayout.java index 19032bf8e..06ccfb6ab 100644 --- a/app/src/main/java/com/github/mobile/ui/CheckableRelativeLayout.java +++ b/app/src/main/java/com/github/pockethub/ui/CheckableRelativeLayout.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.content.Context; import android.util.AttributeSet; diff --git a/app/src/main/java/com/github/mobile/ui/ConfirmDialogFragment.java b/app/src/main/java/com/github/pockethub/ui/ConfirmDialogFragment.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/ConfirmDialogFragment.java rename to app/src/main/java/com/github/pockethub/ui/ConfirmDialogFragment.java index 1af8d68b7..c60aa2928 100644 --- a/app/src/main/java/com/github/mobile/ui/ConfirmDialogFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/ConfirmDialogFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_OK; diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragment.java b/app/src/main/java/com/github/pockethub/ui/DialogFragment.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/DialogFragment.java rename to app/src/main/java/com/github/pockethub/ui/DialogFragment.java index 101001711..25ee071f0 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/DialogFragment.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.app.Activity; import android.os.Bundle; import android.view.View; import com.github.kevinsawicki.wishlist.ViewFinder; -import com.github.mobile.ui.roboactivities.RoboSupportFragment; +import com.github.pockethub.ui.roboactivities.RoboSupportFragment; import java.io.Serializable; diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java b/app/src/main/java/com/github/pockethub/ui/DialogFragmentActivity.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java rename to app/src/main/java/com/github/pockethub/ui/DialogFragmentActivity.java index cffb5de3d..2d2cfd69d 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragmentActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/DialogFragmentActivity.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.os.Bundle; import com.github.kevinsawicki.wishlist.ViewFinder; -import com.github.mobile.ui.roboactivities.RoboActionBarActivity; +import com.github.pockethub.ui.roboactivities.RoboActionBarActivity; import java.io.Serializable; diff --git a/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java b/app/src/main/java/com/github/pockethub/ui/DialogFragmentHelper.java similarity index 99% rename from app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java rename to app/src/main/java/com/github/pockethub/ui/DialogFragmentHelper.java index 214a2af62..658bde06d 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogFragmentHelper.java +++ b/app/src/main/java/com/github/pockethub/ui/DialogFragmentHelper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import static android.app.Activity.RESULT_CANCELED; import android.app.AlertDialog; diff --git a/app/src/main/java/com/github/mobile/ui/DialogResultListener.java b/app/src/main/java/com/github/pockethub/ui/DialogResultListener.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/DialogResultListener.java rename to app/src/main/java/com/github/pockethub/ui/DialogResultListener.java index ad4bc57f7..ba95193a3 100644 --- a/app/src/main/java/com/github/mobile/ui/DialogResultListener.java +++ b/app/src/main/java/com/github/pockethub/ui/DialogResultListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.app.Activity; import android.os.Bundle; diff --git a/app/src/main/java/com/github/mobile/ui/FragmentPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/FragmentPagerAdapter.java similarity index 99% rename from app/src/main/java/com/github/mobile/ui/FragmentPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/FragmentPagerAdapter.java index 1ccc5ea95..0a44c8f48 100644 --- a/app/src/main/java/com/github/mobile/ui/FragmentPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/FragmentPagerAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; diff --git a/app/src/main/java/com/github/mobile/ui/FragmentProvider.java b/app/src/main/java/com/github/pockethub/ui/FragmentProvider.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/FragmentProvider.java rename to app/src/main/java/com/github/pockethub/ui/FragmentProvider.java index 16194d1e6..bcaff5d68 100644 --- a/app/src/main/java/com/github/mobile/ui/FragmentProvider.java +++ b/app/src/main/java/com/github/pockethub/ui/FragmentProvider.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.support.v4.app.Fragment; diff --git a/app/src/main/java/com/github/mobile/ui/FragmentStatePagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/FragmentStatePagerAdapter.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/FragmentStatePagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/FragmentStatePagerAdapter.java index 85bdaf075..023b328a5 100644 --- a/app/src/main/java/com/github/mobile/ui/FragmentStatePagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/FragmentStatePagerAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; diff --git a/app/src/main/java/com/github/mobile/ui/HeaderFooterListAdapter.java b/app/src/main/java/com/github/pockethub/ui/HeaderFooterListAdapter.java similarity index 99% rename from app/src/main/java/com/github/mobile/ui/HeaderFooterListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/HeaderFooterListAdapter.java index 331f034e2..082d9a5a8 100644 --- a/app/src/main/java/com/github/mobile/ui/HeaderFooterListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/HeaderFooterListAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.view.View; import android.widget.BaseAdapter; diff --git a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java b/app/src/main/java/com/github/pockethub/ui/ItemListFragment.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/ItemListFragment.java rename to app/src/main/java/com/github/pockethub/ui/ItemListFragment.java index b68343630..b52db400f 100644 --- a/app/src/main/java/com/github/mobile/ui/ItemListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/ItemListFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.app.Activity; import android.os.Bundle; @@ -35,9 +35,9 @@ import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.util.ToastUtils; import java.util.Collections; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/LightAlertDialog.java b/app/src/main/java/com/github/pockethub/ui/LightAlertDialog.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/LightAlertDialog.java rename to app/src/main/java/com/github/pockethub/ui/LightAlertDialog.java index db627a637..4a0a599cf 100644 --- a/app/src/main/java/com/github/mobile/ui/LightAlertDialog.java +++ b/app/src/main/java/com/github/pockethub/ui/LightAlertDialog.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.app.AlertDialog; import android.content.Context; diff --git a/app/src/main/java/com/github/mobile/ui/LightProgressDialog.java b/app/src/main/java/com/github/pockethub/ui/LightProgressDialog.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/LightProgressDialog.java rename to app/src/main/java/com/github/pockethub/ui/LightProgressDialog.java index 799338087..e18bd39ac 100644 --- a/app/src/main/java/com/github/mobile/ui/LightProgressDialog.java +++ b/app/src/main/java/com/github/pockethub/ui/LightProgressDialog.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; -import com.github.mobile.R; +import com.github.pockethub.R; /** diff --git a/app/src/main/java/com/github/mobile/ui/MainActivity.java b/app/src/main/java/com/github/pockethub/ui/MainActivity.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/MainActivity.java rename to app/src/main/java/com/github/pockethub/ui/MainActivity.java index 4f7c36ad4..44da81411 100644 --- a/app/src/main/java/com/github/mobile/ui/MainActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/MainActivity.java @@ -1,6 +1,6 @@ -package com.github.mobile.ui; +package com.github.pockethub.ui; -import static com.github.mobile.ui.NavigationDrawerObject.TYPE_SEPERATOR; +import static com.github.pockethub.ui.NavigationDrawerObject.TYPE_SEPERATOR; import android.app.SearchManager; import android.content.Context; import android.os.Bundle; @@ -16,16 +16,16 @@ import android.view.View; import android.view.Window; -import com.github.mobile.R; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.core.user.UserComparator; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.ui.gist.GistsPagerFragment; -import com.github.mobile.ui.issue.FilterListFragment; -import com.github.mobile.ui.issue.IssueDashboardPagerFragment; -import com.github.mobile.ui.repo.OrganizationLoader; -import com.github.mobile.ui.user.HomePagerFragment; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.core.user.UserComparator; +import com.github.pockethub.persistence.AccountDataManager; +import com.github.pockethub.ui.gist.GistsPagerFragment; +import com.github.pockethub.ui.issue.FilterListFragment; +import com.github.pockethub.ui.issue.IssueDashboardPagerFragment; +import com.github.pockethub.ui.repo.OrganizationLoader; +import com.github.pockethub.ui.user.HomePagerFragment; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import com.google.inject.Provider; diff --git a/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java b/app/src/main/java/com/github/pockethub/ui/MarkdownLoader.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/MarkdownLoader.java rename to app/src/main/java/com/github/pockethub/ui/MarkdownLoader.java index 06362a96f..be4df5f65 100644 --- a/app/src/main/java/com/github/mobile/ui/MarkdownLoader.java +++ b/app/src/main/java/com/github/pockethub/ui/MarkdownLoader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import static org.eclipse.egit.github.core.service.MarkdownService.MODE_GFM; import android.accounts.Account; @@ -21,8 +21,8 @@ import android.text.Html.ImageGetter; import android.util.Log; -import com.github.mobile.accounts.AuthenticatedUserLoader; -import com.github.mobile.util.HtmlUtils; +import com.github.pockethub.accounts.AuthenticatedUserLoader; +import com.github.pockethub.util.HtmlUtils; import com.google.inject.Inject; import java.io.IOException; diff --git a/app/src/main/java/com/github/mobile/ui/NavigationDrawerAdapter.java b/app/src/main/java/com/github/pockethub/ui/NavigationDrawerAdapter.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/NavigationDrawerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/NavigationDrawerAdapter.java index b429b34c0..974572869 100644 --- a/app/src/main/java/com/github/mobile/ui/NavigationDrawerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/NavigationDrawerAdapter.java @@ -1,9 +1,9 @@ -package com.github.mobile.ui; +package com.github.pockethub.ui; -import static com.github.mobile.ui.NavigationDrawerObject.TYPE_ITEM_MENU; -import static com.github.mobile.ui.NavigationDrawerObject.TYPE_ITEM_ORG; -import static com.github.mobile.ui.NavigationDrawerObject.TYPE_SEPERATOR; -import static com.github.mobile.ui.NavigationDrawerObject.TYPE_SUBHEADER; +import static com.github.pockethub.ui.NavigationDrawerObject.TYPE_ITEM_MENU; +import static com.github.pockethub.ui.NavigationDrawerObject.TYPE_ITEM_ORG; +import static com.github.pockethub.ui.NavigationDrawerObject.TYPE_SEPERATOR; +import static com.github.pockethub.ui.NavigationDrawerObject.TYPE_SUBHEADER; import android.content.Context; import android.graphics.Typeface; import android.view.LayoutInflater; @@ -13,8 +13,8 @@ import android.widget.ImageView; import android.widget.TextView; -import com.github.mobile.R; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.util.AvatarLoader; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java b/app/src/main/java/com/github/pockethub/ui/NavigationDrawerFragment.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java rename to app/src/main/java/com/github/pockethub/ui/NavigationDrawerFragment.java index 22719f1d8..bb21a7a1e 100644 --- a/app/src/main/java/com/github/mobile/ui/NavigationDrawerFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/NavigationDrawerFragment.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.app.Activity; @@ -25,8 +25,8 @@ import android.widget.ListView; import android.widget.TextView; -import com.github.mobile.R; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.util.AvatarLoader; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/NavigationDrawerObject.java b/app/src/main/java/com/github/pockethub/ui/NavigationDrawerObject.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/NavigationDrawerObject.java rename to app/src/main/java/com/github/pockethub/ui/NavigationDrawerObject.java index d5365c716..5385d4fe2 100644 --- a/app/src/main/java/com/github/mobile/ui/NavigationDrawerObject.java +++ b/app/src/main/java/com/github/pockethub/ui/NavigationDrawerObject.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui; +package com.github.pockethub.ui; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/NewsFragment.java b/app/src/main/java/com/github/pockethub/ui/NewsFragment.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/NewsFragment.java rename to app/src/main/java/com/github/pockethub/ui/NewsFragment.java index 099e92fa6..21422f875 100644 --- a/app/src/main/java/com/github/mobile/ui/NewsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/NewsFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import static android.content.Intent.ACTION_VIEW; import static android.content.Intent.CATEGORY_BROWSABLE; @@ -31,19 +31,19 @@ import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewFinder; -import com.github.mobile.R; -import com.github.mobile.core.gist.GistEventMatcher; -import com.github.mobile.core.issue.IssueEventMatcher; -import com.github.mobile.core.repo.RepositoryEventMatcher; -import com.github.mobile.core.user.UserEventMatcher; -import com.github.mobile.core.user.UserEventMatcher.UserPair; -import com.github.mobile.ui.commit.CommitCompareViewActivity; -import com.github.mobile.ui.commit.CommitViewActivity; -import com.github.mobile.ui.gist.GistsViewActivity; -import com.github.mobile.ui.issue.IssuesViewActivity; -import com.github.mobile.ui.repo.RepositoryViewActivity; -import com.github.mobile.ui.user.NewsListAdapter; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.core.gist.GistEventMatcher; +import com.github.pockethub.core.issue.IssueEventMatcher; +import com.github.pockethub.core.repo.RepositoryEventMatcher; +import com.github.pockethub.core.user.UserEventMatcher; +import com.github.pockethub.core.user.UserEventMatcher.UserPair; +import com.github.pockethub.ui.commit.CommitCompareViewActivity; +import com.github.pockethub.ui.commit.CommitViewActivity; +import com.github.pockethub.ui.gist.GistsViewActivity; +import com.github.pockethub.ui.issue.IssuesViewActivity; +import com.github.pockethub.ui.repo.RepositoryViewActivity; +import com.github.pockethub.ui.user.NewsListAdapter; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/PagedItemFragment.java b/app/src/main/java/com/github/pockethub/ui/PagedItemFragment.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/PagedItemFragment.java rename to app/src/main/java/com/github/pockethub/ui/PagedItemFragment.java index 47a857901..5f4ce97be 100644 --- a/app/src/main/java/com/github/mobile/ui/PagedItemFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/PagedItemFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.app.Activity; import android.os.Bundle; @@ -22,8 +22,8 @@ import android.widget.AbsListView.OnScrollListener; import android.widget.ListView; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.core.ResourcePager; import java.io.IOException; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/PagerActivity.java b/app/src/main/java/com/github/pockethub/ui/PagerActivity.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/PagerActivity.java rename to app/src/main/java/com/github/pockethub/ui/PagerActivity.java index ce5f2da06..3687d33a4 100644 --- a/app/src/main/java/com/github/mobile/ui/PagerActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/PagerActivity.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager.OnPageChangeListener; diff --git a/app/src/main/java/com/github/mobile/ui/PagerFragment.java b/app/src/main/java/com/github/pockethub/ui/PagerFragment.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/PagerFragment.java rename to app/src/main/java/com/github/pockethub/ui/PagerFragment.java index 899726650..36eab0e6a 100644 --- a/app/src/main/java/com/github/mobile/ui/PagerFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/PagerFragment.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; diff --git a/app/src/main/java/com/github/mobile/ui/PatchedScrollingViewBehavior.java b/app/src/main/java/com/github/pockethub/ui/PatchedScrollingViewBehavior.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/PatchedScrollingViewBehavior.java rename to app/src/main/java/com/github/pockethub/ui/PatchedScrollingViewBehavior.java index 25e8e0588..efffd510a 100644 --- a/app/src/main/java/com/github/mobile/ui/PatchedScrollingViewBehavior.java +++ b/app/src/main/java/com/github/pockethub/ui/PatchedScrollingViewBehavior.java @@ -1,11 +1,10 @@ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.content.Context; import android.support.design.widget.AppBarLayout; import android.support.design.widget.CoordinatorLayout; import android.support.v4.view.ViewCompat; import android.util.AttributeSet; -import android.util.Log; import android.view.View; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/ProgressDialogTask.java b/app/src/main/java/com/github/pockethub/ui/ProgressDialogTask.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/ProgressDialogTask.java rename to app/src/main/java/com/github/pockethub/ui/ProgressDialogTask.java index 5829febf1..9ce82bfb2 100644 --- a/app/src/main/java/com/github/mobile/ui/ProgressDialogTask.java +++ b/app/src/main/java/com/github/pockethub/ui/ProgressDialogTask.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.app.AlertDialog; import android.content.Context; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.accounts.AuthenticatedUserTask; import java.util.concurrent.Executor; diff --git a/app/src/main/java/com/github/mobile/ui/ResourceLoadingIndicator.java b/app/src/main/java/com/github/pockethub/ui/ResourceLoadingIndicator.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/ResourceLoadingIndicator.java rename to app/src/main/java/com/github/pockethub/ui/ResourceLoadingIndicator.java index 95ccf787b..aa0eaa72a 100644 --- a/app/src/main/java/com/github/mobile/ui/ResourceLoadingIndicator.java +++ b/app/src/main/java/com/github/pockethub/ui/ResourceLoadingIndicator.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; -import com.github.mobile.R; +import com.github.pockethub.R; /** * Helper for showing more items are being loaded at the bottom of a list via a diff --git a/app/src/main/java/com/github/mobile/ui/SelectableLinkMovementMethod.java b/app/src/main/java/com/github/pockethub/ui/SelectableLinkMovementMethod.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/SelectableLinkMovementMethod.java rename to app/src/main/java/com/github/pockethub/ui/SelectableLinkMovementMethod.java index 780b9cc0f..bd19cf1d6 100644 --- a/app/src/main/java/com/github/mobile/ui/SelectableLinkMovementMethod.java +++ b/app/src/main/java/com/github/pockethub/ui/SelectableLinkMovementMethod.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.text.NoCopySpan; import android.text.Spannable; diff --git a/app/src/main/java/com/github/mobile/ui/SingleChoiceDialogFragment.java b/app/src/main/java/com/github/pockethub/ui/SingleChoiceDialogFragment.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/SingleChoiceDialogFragment.java rename to app/src/main/java/com/github/pockethub/ui/SingleChoiceDialogFragment.java index b2ef971f7..00b10f40d 100644 --- a/app/src/main/java/com/github/mobile/ui/SingleChoiceDialogFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/SingleChoiceDialogFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; diff --git a/app/src/main/java/com/github/mobile/ui/StyledText.java b/app/src/main/java/com/github/pockethub/ui/StyledText.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/StyledText.java rename to app/src/main/java/com/github/pockethub/ui/StyledText.java index fb5e4de6c..bc3283103 100644 --- a/app/src/main/java/com/github/mobile/ui/StyledText.java +++ b/app/src/main/java/com/github/pockethub/ui/StyledText.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import static android.graphics.Typeface.BOLD; import android.text.SpannableStringBuilder; @@ -26,7 +26,7 @@ import android.view.View; import android.view.View.OnClickListener; -import com.github.mobile.util.TimeUtils; +import com.github.pockethub.util.TimeUtils; import java.util.Date; import java.util.Locale; diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java b/app/src/main/java/com/github/pockethub/ui/TabPagerActivity.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/TabPagerActivity.java rename to app/src/main/java/com/github/pockethub/ui/TabPagerActivity.java index 8f7ae7321..1bb26aa13 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/TabPagerActivity.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.os.Bundle; import android.support.design.widget.TabLayout; @@ -23,7 +23,7 @@ import android.widget.TabHost.TabContentFactory; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; +import com.github.pockethub.R; /** * Activity with tabbed pages diff --git a/app/src/main/java/com/github/mobile/ui/TabPagerFragment.java b/app/src/main/java/com/github/pockethub/ui/TabPagerFragment.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/TabPagerFragment.java rename to app/src/main/java/com/github/pockethub/ui/TabPagerFragment.java index d08e6d481..7b9435317 100644 --- a/app/src/main/java/com/github/mobile/ui/TabPagerFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/TabPagerFragment.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.os.Bundle; import android.support.annotation.Nullable; @@ -10,7 +10,7 @@ import android.view.ViewGroup; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; +import com.github.pockethub.R; import static android.widget.TabHost.OnTabChangeListener; import static android.widget.TabHost.TabContentFactory; diff --git a/app/src/main/java/com/github/mobile/ui/TextWatcherAdapter.java b/app/src/main/java/com/github/pockethub/ui/TextWatcherAdapter.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/TextWatcherAdapter.java rename to app/src/main/java/com/github/pockethub/ui/TextWatcherAdapter.java index 2a1ef1f23..e0c1a0abb 100644 --- a/app/src/main/java/com/github/mobile/ui/TextWatcherAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/TextWatcherAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.text.Editable; import android.text.TextWatcher; diff --git a/app/src/main/java/com/github/mobile/ui/ViewPager.java b/app/src/main/java/com/github/pockethub/ui/ViewPager.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/ViewPager.java rename to app/src/main/java/com/github/pockethub/ui/ViewPager.java index 6cfdf599f..8ab6138b9 100644 --- a/app/src/main/java/com/github/mobile/ui/ViewPager.java +++ b/app/src/main/java/com/github/pockethub/ui/ViewPager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.content.Context; import android.util.AttributeSet; diff --git a/app/src/main/java/com/github/mobile/ui/WebView.java b/app/src/main/java/com/github/pockethub/ui/WebView.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/WebView.java rename to app/src/main/java/com/github/pockethub/ui/WebView.java index 5d085428f..659ff5be4 100644 --- a/app/src/main/java/com/github/mobile/ui/WebView.java +++ b/app/src/main/java/com/github/pockethub/ui/WebView.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui; +package com.github.pockethub.ui; import android.content.Context; import android.util.AttributeSet; diff --git a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java b/app/src/main/java/com/github/pockethub/ui/code/RepositoryCodeFragment.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java rename to app/src/main/java/com/github/pockethub/ui/code/RepositoryCodeFragment.java index e01a5a971..79a357061 100644 --- a/app/src/main/java/com/github/mobile/ui/code/RepositoryCodeFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/code/RepositoryCodeFragment.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.code; +package com.github.pockethub.ui.code; import static android.app.Activity.RESULT_OK; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; -import static com.github.mobile.RequestCodes.REF_UPDATE; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.RequestCodes.REF_UPDATE; import android.app.Activity; import android.os.Bundle; import android.text.method.LinkMovementMethod; @@ -35,22 +35,22 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.core.code.FullTree; -import com.github.mobile.core.code.FullTree.Entry; -import com.github.mobile.core.code.FullTree.Folder; -import com.github.mobile.core.code.RefreshTreeTask; -import com.github.mobile.core.ref.RefUtils; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.HeaderFooterListAdapter; -import com.github.mobile.ui.StyledText; -import com.github.mobile.ui.ref.BranchFileViewActivity; -import com.github.mobile.ui.ref.CodeTreeAdapter; -import com.github.mobile.ui.ref.RefDialog; -import com.github.mobile.ui.ref.RefDialogFragment; -import com.github.mobile.util.ToastUtils; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.code.FullTree; +import com.github.pockethub.core.code.FullTree.Entry; +import com.github.pockethub.core.code.FullTree.Folder; +import com.github.pockethub.core.code.RefreshTreeTask; +import com.github.pockethub.core.ref.RefUtils; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.HeaderFooterListAdapter; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.ui.ref.BranchFileViewActivity; +import com.github.pockethub.ui.ref.CodeTreeAdapter; +import com.github.pockethub.ui.ref.RefDialog; +import com.github.pockethub.ui.ref.RefDialogFragment; +import com.github.pockethub.util.ToastUtils; +import com.github.pockethub.util.TypefaceUtils; import com.google.inject.Inject; import java.util.LinkedList; diff --git a/app/src/main/java/com/github/mobile/ui/comment/CommentListAdapter.java b/app/src/main/java/com/github/pockethub/ui/comment/CommentListAdapter.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/comment/CommentListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/comment/CommentListAdapter.java index aab7b8ddc..79cada42b 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/CommentListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/CommentListAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.comment; +package com.github.pockethub.ui.comment; import android.content.Context; import android.support.v7.widget.PopupMenu; @@ -26,11 +26,11 @@ import android.widget.ImageView; import com.github.kevinsawicki.wishlist.MultiTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.HttpImageGetter; -import com.github.mobile.util.TimeUtils; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.HttpImageGetter; +import com.github.pockethub.util.TimeUtils; +import com.github.pockethub.util.TypefaceUtils; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/comment/CommentPreviewPagerAdapter.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/comment/CommentPreviewPagerAdapter.java index 524e8414c..91b195ee5 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/CommentPreviewPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/CommentPreviewPagerAdapter.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.comment; +package com.github.pockethub.ui.comment; import android.content.Context; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; -import com.github.mobile.R; -import com.github.mobile.ui.FragmentPagerAdapter; +import com.github.pockethub.R; +import com.github.pockethub.ui.FragmentPagerAdapter; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java b/app/src/main/java/com/github/pockethub/ui/comment/CreateCommentActivity.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java rename to app/src/main/java/com/github/pockethub/ui/comment/CreateCommentActivity.java index 11eaf7996..4bb1667ec 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/CreateCommentActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/CreateCommentActivity.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.comment; +package com.github.pockethub.ui.comment; import android.content.Intent; import android.os.Bundle; @@ -21,16 +21,16 @@ import android.view.Menu; import android.view.MenuItem; -import com.github.mobile.R; -import com.github.mobile.ui.TabPagerActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.ui.TabPagerActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import org.eclipse.egit.github.core.Comment; -import static com.github.mobile.Intents.EXTRA_COMMENT; -import static com.github.mobile.util.TypefaceUtils.ICON_EDIT; -import static com.github.mobile.util.TypefaceUtils.ICON_WATCH; +import static com.github.pockethub.Intents.EXTRA_COMMENT; +import static com.github.pockethub.util.TypefaceUtils.ICON_EDIT; +import static com.github.pockethub.util.TypefaceUtils.ICON_WATCH; /** * Base activity for creating comments diff --git a/app/src/main/java/com/github/mobile/ui/comment/DeleteCommentListener.java b/app/src/main/java/com/github/pockethub/ui/comment/DeleteCommentListener.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/comment/DeleteCommentListener.java rename to app/src/main/java/com/github/pockethub/ui/comment/DeleteCommentListener.java index 0976ad1cd..87491827a 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/DeleteCommentListener.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/DeleteCommentListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.comment; +package com.github.pockethub.ui.comment; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/comment/EditCommentListener.java b/app/src/main/java/com/github/pockethub/ui/comment/EditCommentListener.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/comment/EditCommentListener.java rename to app/src/main/java/com/github/pockethub/ui/comment/EditCommentListener.java index 9d0ca5c6d..f31884ad2 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/EditCommentListener.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/EditCommentListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.comment; +package com.github.pockethub.ui.comment; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java b/app/src/main/java/com/github/pockethub/ui/comment/RawCommentFragment.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java rename to app/src/main/java/com/github/pockethub/ui/comment/RawCommentFragment.java index 01e4d4ca3..b480de1cc 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RawCommentFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/RawCommentFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.comment; +package com.github.pockethub.ui.comment; import android.app.Activity; import android.os.Bundle; @@ -24,9 +24,9 @@ import android.view.ViewGroup; import android.widget.EditText; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.ui.TextWatcherAdapter; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.ui.TextWatcherAdapter; /** * Fragment to display raw comment text diff --git a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java b/app/src/main/java/com/github/pockethub/ui/comment/RenderedCommentFragment.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java rename to app/src/main/java/com/github/pockethub/ui/comment/RenderedCommentFragment.java index 2d4d21f95..1578c6439 100644 --- a/app/src/main/java/com/github/mobile/ui/comment/RenderedCommentFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/RenderedCommentFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.comment; +package com.github.pockethub.ui.comment; import android.os.Bundle; import android.support.v4.app.LoaderManager.LoaderCallbacks; @@ -26,11 +26,11 @@ import com.github.kevinsawicki.wishlist.Keyboard; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.ui.MarkdownLoader; -import com.github.mobile.util.HttpImageGetter; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.ui.MarkdownLoader; +import com.github.pockethub.util.HttpImageGetter; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import java.io.Serializable; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitCompareListFragment.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitCompareListFragment.java index 0e19d56a5..98ba46e84 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitCompareListFragment.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; -import static com.github.mobile.Intents.EXTRA_BASE; -import static com.github.mobile.Intents.EXTRA_HEAD; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_BASE; +import static com.github.pockethub.Intents.EXTRA_HEAD; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.accounts.Account; import android.app.Activity; import android.os.Bundle; @@ -35,13 +35,13 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.core.commit.CommitCompareTask; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.ui.HeaderFooterListAdapter; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.commit.CommitCompareTask; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.ui.HeaderFooterListAdapter; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import java.text.MessageFormat; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitCompareViewActivity.java similarity index 87% rename from app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitCompareViewActivity.java index a9904143d..b7c0b2424 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitCompareViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitCompareViewActivity.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_BASE; -import static com.github.mobile.Intents.EXTRA_HEAD; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_BASE; +import static com.github.pockethub.Intents.EXTRA_HEAD; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; @@ -27,11 +27,11 @@ import android.view.Menu; import android.view.MenuItem; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.repo.RepositoryViewActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.repo.RepositoryViewActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitDiffListFragment.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitDiffListFragment.java index 2ac27f593..51ab38254 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitDiffListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitDiffListFragment.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import static android.app.Activity.RESULT_OK; import static android.content.DialogInterface.BUTTON_NEGATIVE; import static android.graphics.Paint.UNDERLINE_TEXT_FLAG; -import static com.github.mobile.Intents.EXTRA_BASE; -import static com.github.mobile.Intents.EXTRA_COMMENT; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; -import static com.github.mobile.RequestCodes.COMMENT_CREATE; +import static com.github.pockethub.Intents.EXTRA_BASE; +import static com.github.pockethub.Intents.EXTRA_COMMENT; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.RequestCodes.COMMENT_CREATE; import android.accounts.Account; import android.annotation.SuppressLint; import android.app.AlertDialog; @@ -50,20 +50,20 @@ import com.github.kevinsawicki.wishlist.ViewFinder; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.core.commit.CommitStore; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.core.commit.FullCommit; -import com.github.mobile.core.commit.FullCommitFile; -import com.github.mobile.core.commit.RefreshCommitTask; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.ui.HeaderFooterListAdapter; -import com.github.mobile.ui.LightAlertDialog; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.HttpImageGetter; -import com.github.mobile.util.ShareUtils; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.commit.CommitStore; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.core.commit.FullCommit; +import com.github.pockethub.core.commit.FullCommitFile; +import com.github.pockethub.core.commit.RefreshCommitTask; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.ui.HeaderFooterListAdapter; +import com.github.pockethub.ui.LightAlertDialog; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.HttpImageGetter; +import com.github.pockethub.util.ShareUtils; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import java.util.Collections; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileComparator.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitFileComparator.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/commit/CommitFileComparator.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitFileComparator.java index 48a3e3446..fc5ecefe3 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileComparator.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitFileComparator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import static java.lang.String.CASE_INSENSITIVE_ORDER; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitFileListAdapter.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitFileListAdapter.java index 63ebf4cb1..d8382a8e7 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitFileListAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import static com.github.kevinsawicki.wishlist.ViewUpdater.FORMAT_INT; import android.content.res.Resources; @@ -22,12 +22,12 @@ import com.github.kevinsawicki.wishlist.MultiTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.core.commit.FullCommitFile; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.HttpImageGetter; -import com.github.mobile.util.TimeUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.commit.FullCommitFile; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.HttpImageGetter; +import com.github.pockethub.util.TimeUtils; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitFileViewActivity.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitFileViewActivity.java index 85a2fff6c..626765c71 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitFileViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitFileViewActivity.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; - -import static com.github.mobile.Intents.EXTRA_BASE; -import static com.github.mobile.Intents.EXTRA_HEAD; -import static com.github.mobile.Intents.EXTRA_PATH; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; -import static com.github.mobile.util.PreferenceUtils.RENDER_MARKDOWN; -import static com.github.mobile.util.PreferenceUtils.WRAP; +package com.github.pockethub.ui.commit; + +import static com.github.pockethub.Intents.EXTRA_BASE; +import static com.github.pockethub.Intents.EXTRA_HEAD; +import static com.github.pockethub.Intents.EXTRA_PATH; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.util.PreferenceUtils.RENDER_MARKDOWN; +import static com.github.pockethub.util.PreferenceUtils.WRAP; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.LoaderManager.LoaderCallbacks; @@ -34,19 +34,19 @@ import android.widget.ProgressBar; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.code.RefreshBlobTask; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.ui.BaseActivity; -import com.github.mobile.ui.MarkdownLoader; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.HttpImageGetter; -import com.github.mobile.util.MarkdownUtils; -import com.github.mobile.util.PreferenceUtils; -import com.github.mobile.util.ShareUtils; -import com.github.mobile.util.SourceEditor; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.code.RefreshBlobTask; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.ui.BaseActivity; +import com.github.pockethub.ui.MarkdownLoader; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.HttpImageGetter; +import com.github.pockethub.util.MarkdownUtils; +import com.github.pockethub.util.PreferenceUtils; +import com.github.pockethub.util.ShareUtils; +import com.github.pockethub.util.SourceEditor; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Blob; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitListAdapter.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitListAdapter.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/commit/CommitListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitListAdapter.java index b5eb4fe40..53dfc6bf1 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitListAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import android.text.TextUtils; import android.view.LayoutInflater; @@ -21,11 +21,11 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TypefaceUtils; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitListFragment.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitListFragment.java index 471c6d6f3..7eb5a81f1 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitListFragment.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import static android.app.Activity.RESULT_OK; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; -import static com.github.mobile.RequestCodes.COMMIT_VIEW; -import static com.github.mobile.RequestCodes.REF_UPDATE; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.RequestCodes.COMMIT_VIEW; +import static com.github.pockethub.RequestCodes.REF_UPDATE; import android.app.Activity; import android.content.Intent; import android.os.Bundle; @@ -33,20 +33,20 @@ import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.commit.CommitPager; -import com.github.mobile.core.commit.CommitStore; -import com.github.mobile.core.ref.RefUtils; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.DialogResultListener; -import com.github.mobile.ui.ItemListFragment; -import com.github.mobile.ui.PagedItemFragment; -import com.github.mobile.ui.ref.RefDialog; -import com.github.mobile.ui.ref.RefDialogFragment; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.commit.CommitPager; +import com.github.pockethub.core.commit.CommitStore; +import com.github.pockethub.core.ref.RefUtils; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.DialogResultListener; +import com.github.pockethub.ui.ItemListFragment; +import com.github.pockethub.ui.PagedItemFragment; +import com.github.pockethub.ui.ref.RefDialog; +import com.github.pockethub.ui.ref.RefDialogFragment; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TypefaceUtils; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitPagerAdapter.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/commit/CommitPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitPagerAdapter.java index 37d402b8d..6ad6f96df 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitPagerAdapter.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; -import static com.github.mobile.Intents.EXTRA_BASE; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_BASE; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; -import com.github.mobile.ui.FragmentStatePagerAdapter; +import com.github.pockethub.ui.FragmentStatePagerAdapter; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitViewActivity.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/commit/CommitViewActivity.java index 0f0fbb9c6..1a77302db 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CommitViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitViewActivity.java @@ -13,26 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_BASES; -import static com.github.mobile.Intents.EXTRA_POSITION; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_BASES; +import static com.github.pockethub.Intents.EXTRA_POSITION; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.view.MenuItem; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.ui.FragmentProvider; -import com.github.mobile.ui.PagerActivity; -import com.github.mobile.ui.ViewPager; -import com.github.mobile.ui.repo.RepositoryViewActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.ui.FragmentProvider; +import com.github.pockethub.ui.PagerActivity; +import com.github.pockethub.ui.ViewPager; +import com.github.pockethub.ui.repo.RepositoryViewActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/commit/CreateCommentActivity.java b/app/src/main/java/com/github/pockethub/ui/commit/CreateCommentActivity.java similarity index 86% rename from app/src/main/java/com/github/mobile/ui/commit/CreateCommentActivity.java rename to app/src/main/java/com/github/pockethub/ui/commit/CreateCommentActivity.java index a5d97e7c2..695b73811 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CreateCommentActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CreateCommentActivity.java @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; -import static com.github.mobile.Intents.EXTRA_BASE; -import static com.github.mobile.Intents.EXTRA_PATH; -import static com.github.mobile.Intents.EXTRA_POSITION; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_BASE; +import static com.github.pockethub.Intents.EXTRA_PATH; +import static com.github.pockethub.Intents.EXTRA_POSITION; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.text.TextUtils; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.ui.comment.CommentPreviewPagerAdapter; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.ui.comment.CommentPreviewPagerAdapter; import org.eclipse.egit.github.core.CommitComment; import org.eclipse.egit.github.core.Repository; @@ -36,7 +36,7 @@ * Activity to create a comment on a commit */ public class CreateCommentActivity extends - com.github.mobile.ui.comment.CreateCommentActivity { + com.github.pockethub.ui.comment.CreateCommentActivity { /** * Create intent to create a comment diff --git a/app/src/main/java/com/github/mobile/ui/commit/CreateCommentTask.java b/app/src/main/java/com/github/pockethub/ui/commit/CreateCommentTask.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/commit/CreateCommentTask.java rename to app/src/main/java/com/github/pockethub/ui/commit/CreateCommentTask.java index 8a09fb1ae..006167bd0 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/CreateCommentTask.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CreateCommentTask.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import android.accounts.Account; import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.HtmlUtils; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.HtmlUtils; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.CommitComment; diff --git a/app/src/main/java/com/github/mobile/ui/commit/DiffStyler.java b/app/src/main/java/com/github/pockethub/ui/commit/DiffStyler.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/commit/DiffStyler.java rename to app/src/main/java/com/github/pockethub/ui/commit/DiffStyler.java index 503c1be9f..c5d5aa6b4 100644 --- a/app/src/main/java/com/github/mobile/ui/commit/DiffStyler.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/DiffStyler.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.commit; +package com.github.pockethub.ui.commit; import android.content.res.Resources; import android.text.TextUtils; import android.widget.TextView; -import com.github.mobile.R; +import com.github.pockethub.R; import java.util.ArrayList; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/gist/CreateCommentActivity.java b/app/src/main/java/com/github/pockethub/ui/gist/CreateCommentActivity.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/gist/CreateCommentActivity.java rename to app/src/main/java/com/github/pockethub/ui/gist/CreateCommentActivity.java index 894e029c4..cd1b66eb7 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/CreateCommentActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/CreateCommentActivity.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import static com.github.mobile.Intents.EXTRA_GIST; +import static com.github.pockethub.Intents.EXTRA_GIST; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; import org.eclipse.egit.github.core.Comment; import org.eclipse.egit.github.core.Gist; @@ -31,7 +31,7 @@ * Activity to create a comment on a {@link Gist} */ public class CreateCommentActivity extends - com.github.mobile.ui.comment.CreateCommentActivity { + com.github.pockethub.ui.comment.CreateCommentActivity { /** * Create intent to create a comment diff --git a/app/src/main/java/com/github/mobile/ui/gist/CreateCommentTask.java b/app/src/main/java/com/github/pockethub/ui/gist/CreateCommentTask.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/gist/CreateCommentTask.java rename to app/src/main/java/com/github/pockethub/ui/gist/CreateCommentTask.java index 86b57a04f..fce9a32b6 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/CreateCommentTask.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/CreateCommentTask.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import android.accounts.Account; import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.HtmlUtils; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.HtmlUtils; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java b/app/src/main/java/com/github/pockethub/ui/gist/CreateGistActivity.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java rename to app/src/main/java/com/github/pockethub/ui/gist/CreateGistActivity.java index 0786db649..1636dc30a 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/CreateGistActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/CreateGistActivity.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; @@ -27,11 +27,11 @@ import android.widget.CheckBox; import android.widget.EditText; -import com.github.mobile.R; -import com.github.mobile.ui.BaseActivity; -import com.github.mobile.ui.MainActivity; -import com.github.mobile.ui.TextWatcherAdapter; -import com.github.mobile.util.ShareUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.BaseActivity; +import com.github.pockethub.ui.MainActivity; +import com.github.pockethub.ui.TextWatcherAdapter; +import com.github.pockethub.util.ShareUtils; import org.eclipse.egit.github.core.Gist; diff --git a/app/src/main/java/com/github/mobile/ui/gist/CreateGistTask.java b/app/src/main/java/com/github/pockethub/ui/gist/CreateGistTask.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/gist/CreateGistTask.java rename to app/src/main/java/com/github/pockethub/ui/gist/CreateGistTask.java index fb552c178..6e28cde0f 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/CreateGistTask.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/CreateGistTask.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import android.accounts.Account; import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import java.util.Collections; diff --git a/app/src/main/java/com/github/mobile/ui/gist/DeleteCommentTask.java b/app/src/main/java/com/github/pockethub/ui/gist/DeleteCommentTask.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/gist/DeleteCommentTask.java rename to app/src/main/java/com/github/pockethub/ui/gist/DeleteCommentTask.java index 216940609..75764af99 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/DeleteCommentTask.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/DeleteCommentTask.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_COMMENTS; @@ -22,9 +22,9 @@ import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/gist/DeleteGistTask.java b/app/src/main/java/com/github/pockethub/ui/gist/DeleteGistTask.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/gist/DeleteGistTask.java rename to app/src/main/java/com/github/pockethub/ui/gist/DeleteGistTask.java index 3d1952d7e..42abc3d03 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/DeleteGistTask.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/DeleteGistTask.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import static android.app.Activity.RESULT_OK; import android.accounts.Account; import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Gist; diff --git a/app/src/main/java/com/github/mobile/ui/gist/EditCommentActivity.java b/app/src/main/java/com/github/pockethub/ui/gist/EditCommentActivity.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/gist/EditCommentActivity.java rename to app/src/main/java/com/github/pockethub/ui/gist/EditCommentActivity.java index 0b7fdd54e..cfa0c2173 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/EditCommentActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/EditCommentActivity.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import static com.github.mobile.Intents.EXTRA_COMMENT; -import static com.github.mobile.Intents.EXTRA_GIST; +import static com.github.pockethub.Intents.EXTRA_COMMENT; +import static com.github.pockethub.Intents.EXTRA_GIST; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.ui.comment.CommentPreviewPagerAdapter; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.ui.comment.CommentPreviewPagerAdapter; import org.eclipse.egit.github.core.Comment; import org.eclipse.egit.github.core.Gist; @@ -33,7 +33,7 @@ * Activity to edit a comment on a {@link Gist} */ public class EditCommentActivity extends - com.github.mobile.ui.comment.CreateCommentActivity { + com.github.pockethub.ui.comment.CreateCommentActivity { /** * Create intent to edit a comment diff --git a/app/src/main/java/com/github/mobile/ui/gist/EditCommentTask.java b/app/src/main/java/com/github/pockethub/ui/gist/EditCommentTask.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/gist/EditCommentTask.java rename to app/src/main/java/com/github/pockethub/ui/gist/EditCommentTask.java index 9bea60794..9a919564b 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/EditCommentTask.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/EditCommentTask.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_COMMENTS; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_GISTS; @@ -21,10 +21,10 @@ import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.HtmlUtils; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.HtmlUtils; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java b/app/src/main/java/com/github/pockethub/ui/gist/GistFileFragment.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistFileFragment.java index ed14b4efd..df0334376 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFileFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistFileFragment.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import static com.github.mobile.Intents.EXTRA_GIST_FILE; -import static com.github.mobile.Intents.EXTRA_GIST_ID; -import static com.github.mobile.util.PreferenceUtils.WRAP; +import static com.github.pockethub.Intents.EXTRA_GIST_FILE; +import static com.github.pockethub.Intents.EXTRA_GIST_ID; +import static com.github.pockethub.util.PreferenceUtils.WRAP; import android.accounts.Account; import android.app.Activity; import android.content.SharedPreferences; @@ -31,13 +31,13 @@ import android.view.ViewGroup; import android.webkit.WebView; -import com.github.mobile.R; -import com.github.mobile.accounts.AuthenticatedUserTask; -import com.github.mobile.core.gist.GistStore; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.util.PreferenceUtils; -import com.github.mobile.util.SourceEditor; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AuthenticatedUserTask; +import com.github.pockethub.core.gist.GistStore; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.util.PreferenceUtils; +import com.github.pockethub.util.SourceEditor; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import java.io.IOException; diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFilesPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/gist/GistFilesPagerAdapter.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/gist/GistFilesPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistFilesPagerAdapter.java index 1e668cc5d..db3e3aeee 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFilesPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistFilesPagerAdapter.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import static com.github.mobile.Intents.EXTRA_GIST_FILE; +import static com.github.pockethub.Intents.EXTRA_GIST_FILE; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; -import com.github.mobile.ui.FragmentPagerAdapter; +import com.github.pockethub.ui.FragmentPagerAdapter; import java.util.Map; diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java b/app/src/main/java/com/github/pockethub/ui/gist/GistFilesViewActivity.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistFilesViewActivity.java index 7957a6229..a39c4cc40 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFilesViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistFilesViewActivity.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_GIST_ID; -import static com.github.mobile.Intents.EXTRA_POSITION; +import static com.github.pockethub.Intents.EXTRA_GIST_ID; +import static com.github.pockethub.Intents.EXTRA_POSITION; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; @@ -26,16 +26,16 @@ import android.widget.ProgressBar; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.gist.FullGist; -import com.github.mobile.core.gist.GistStore; -import com.github.mobile.core.gist.RefreshGistTask; -import com.github.mobile.ui.FragmentProvider; -import com.github.mobile.ui.PagerActivity; -import com.github.mobile.ui.ViewPager; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.HttpImageGetter; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.gist.FullGist; +import com.github.pockethub.core.gist.GistStore; +import com.github.pockethub.core.gist.RefreshGistTask; +import com.github.pockethub.ui.FragmentProvider; +import com.github.pockethub.ui.PagerActivity; +import com.github.pockethub.ui.ViewPager; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.HttpImageGetter; import com.google.inject.Inject; import com.viewpagerindicator.TitlePageIndicator; diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java b/app/src/main/java/com/github/pockethub/ui/gist/GistFragment.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/gist/GistFragment.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistFragment.java index 9bfb07da5..cfc365197 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistFragment.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import static android.app.Activity.RESULT_OK; import static android.view.View.GONE; import static android.view.View.VISIBLE; -import static com.github.mobile.Intents.EXTRA_COMMENT; -import static com.github.mobile.Intents.EXTRA_GIST_ID; -import static com.github.mobile.RequestCodes.COMMENT_CREATE; -import static com.github.mobile.RequestCodes.COMMENT_DELETE; -import static com.github.mobile.RequestCodes.COMMENT_EDIT; +import static com.github.pockethub.Intents.EXTRA_COMMENT; +import static com.github.pockethub.Intents.EXTRA_GIST_ID; +import static com.github.pockethub.RequestCodes.COMMENT_CREATE; +import static com.github.pockethub.RequestCodes.COMMENT_DELETE; +import static com.github.pockethub.RequestCodes.COMMENT_EDIT; import android.app.Activity; import android.content.Intent; import android.graphics.Typeface; @@ -42,27 +42,26 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.core.OnLoadListener; -import com.github.mobile.core.gist.FullGist; -import com.github.mobile.core.gist.GistStore; -import com.github.mobile.core.gist.RefreshGistTask; -import com.github.mobile.core.gist.StarGistTask; -import com.github.mobile.core.gist.UnstarGistTask; -import com.github.mobile.ui.ConfirmDialogFragment; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.HeaderFooterListAdapter; -import com.github.mobile.ui.StyledText; -import com.github.mobile.ui.comment.CommentListAdapter; -import com.github.mobile.ui.comment.DeleteCommentListener; -import com.github.mobile.ui.comment.EditCommentListener; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.HttpImageGetter; -import com.github.mobile.util.ShareUtils; -import com.github.mobile.util.ToastUtils; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.core.OnLoadListener; +import com.github.pockethub.core.gist.FullGist; +import com.github.pockethub.core.gist.GistStore; +import com.github.pockethub.core.gist.RefreshGistTask; +import com.github.pockethub.core.gist.StarGistTask; +import com.github.pockethub.core.gist.UnstarGistTask; +import com.github.pockethub.ui.ConfirmDialogFragment; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.ui.HeaderFooterListAdapter; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.ui.comment.CommentListAdapter; +import com.github.pockethub.ui.comment.DeleteCommentListener; +import com.github.pockethub.ui.comment.EditCommentListener; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.HttpImageGetter; +import com.github.pockethub.util.ShareUtils; +import com.github.pockethub.util.ToastUtils; +import com.github.pockethub.util.TypefaceUtils; import com.google.inject.Inject; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistListAdapter.java b/app/src/main/java/com/github/pockethub/ui/gist/GistListAdapter.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/gist/GistListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistListAdapter.java index 4e0929bd1..c31b3c112 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistListAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import android.app.Activity; import android.text.TextUtils; @@ -21,10 +21,10 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TypefaceUtils; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistQueriesPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/gist/GistQueriesPagerAdapter.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/gist/GistQueriesPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistQueriesPagerAdapter.java index e06f7b67c..2feb1fde1 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistQueriesPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistQueriesPagerAdapter.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import android.content.res.Resources; import android.support.v4.app.Fragment; -import com.github.mobile.R; -import com.github.mobile.ui.FragmentPagerAdapter; +import com.github.pockethub.R; +import com.github.pockethub.ui.FragmentPagerAdapter; /** * Pager adapter for different Gist queries diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsFragment.java b/app/src/main/java/com/github/pockethub/ui/gist/GistsFragment.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/gist/GistsFragment.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistsFragment.java index 4bdcabd51..83bb50159 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistsFragment.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import static com.github.mobile.RequestCodes.GIST_CREATE; -import static com.github.mobile.RequestCodes.GIST_VIEW; +import static com.github.pockethub.RequestCodes.GIST_CREATE; +import static com.github.pockethub.RequestCodes.GIST_VIEW; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; @@ -24,10 +24,10 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.core.gist.GistStore; -import com.github.mobile.ui.PagedItemFragment; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.core.gist.GistStore; +import com.github.pockethub.ui.PagedItemFragment; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/gist/GistsPagerAdapter.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/gist/GistsPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistsPagerAdapter.java index 018c4d19c..18b55c0dd 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistsPagerAdapter.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import static com.github.mobile.Intents.EXTRA_GIST_ID; +import static com.github.pockethub.Intents.EXTRA_GIST_ID; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.util.SparseArray; import android.view.ViewGroup; -import com.github.mobile.ui.FragmentStatePagerAdapter; +import com.github.pockethub.ui.FragmentStatePagerAdapter; /** * Adapter to page through an array of Gists diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java b/app/src/main/java/com/github/pockethub/ui/gist/GistsPagerFragment.java similarity index 82% rename from app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistsPagerFragment.java index 5f1c617d0..b35faf6b2 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsPagerFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistsPagerFragment.java @@ -1,8 +1,8 @@ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import static com.github.mobile.util.TypefaceUtils.ICON_PERSON; -import static com.github.mobile.util.TypefaceUtils.ICON_STAR; -import static com.github.mobile.util.TypefaceUtils.ICON_TEAM; +import static com.github.pockethub.util.TypefaceUtils.ICON_PERSON; +import static com.github.pockethub.util.TypefaceUtils.ICON_STAR; +import static com.github.pockethub.util.TypefaceUtils.ICON_TEAM; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.Menu; @@ -10,8 +10,8 @@ import android.view.MenuItem; import android.view.View; -import com.github.mobile.R; -import com.github.mobile.ui.TabPagerFragment; +import com.github.pockethub.R; +import com.github.pockethub.ui.TabPagerFragment; public class GistsPagerFragment extends TabPagerFragment { diff --git a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java b/app/src/main/java/com/github/pockethub/ui/gist/GistsViewActivity.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/gist/GistsViewActivity.java index dbd9cfde6..8d02917ff 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistsViewActivity.java @@ -13,30 +13,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_GIST; -import static com.github.mobile.Intents.EXTRA_GIST_ID; -import static com.github.mobile.Intents.EXTRA_GIST_IDS; -import static com.github.mobile.Intents.EXTRA_POSITION; +import static com.github.pockethub.Intents.EXTRA_GIST; +import static com.github.pockethub.Intents.EXTRA_GIST_ID; +import static com.github.pockethub.Intents.EXTRA_GIST_IDS; +import static com.github.pockethub.Intents.EXTRA_POSITION; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.view.MenuItem; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.OnLoadListener; -import com.github.mobile.core.gist.GistStore; -import com.github.mobile.ui.ConfirmDialogFragment; -import com.github.mobile.ui.FragmentProvider; -import com.github.mobile.ui.MainActivity; -import com.github.mobile.ui.PagerActivity; -import com.github.mobile.ui.ViewPager; -import com.github.mobile.ui.user.UriLauncherActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.OnLoadListener; +import com.github.pockethub.core.gist.GistStore; +import com.github.pockethub.ui.ConfirmDialogFragment; +import com.github.pockethub.ui.FragmentProvider; +import com.github.pockethub.ui.MainActivity; +import com.github.pockethub.ui.PagerActivity; +import com.github.pockethub.ui.ViewPager; +import com.github.pockethub.ui.user.UriLauncherActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.io.Serializable; diff --git a/app/src/main/java/com/github/mobile/ui/gist/MyGistsFragment.java b/app/src/main/java/com/github/pockethub/ui/gist/MyGistsFragment.java similarity index 84% rename from app/src/main/java/com/github/mobile/ui/gist/MyGistsFragment.java rename to app/src/main/java/com/github/pockethub/ui/gist/MyGistsFragment.java index 5438d955e..17333ea53 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/MyGistsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/MyGistsFragment.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; import static android.app.Activity.RESULT_OK; -import static com.github.mobile.RequestCodes.GIST_CREATE; -import static com.github.mobile.RequestCodes.GIST_VIEW; +import static com.github.pockethub.RequestCodes.GIST_CREATE; +import static com.github.pockethub.RequestCodes.GIST_VIEW; import android.content.Intent; -import com.github.mobile.accounts.GitHubAccount; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.gist.GistPager; +import com.github.pockethub.accounts.GitHubAccount; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.gist.GistPager; import com.google.inject.Inject; import com.google.inject.Provider; diff --git a/app/src/main/java/com/github/mobile/ui/gist/PublicGistsFragment.java b/app/src/main/java/com/github/pockethub/ui/gist/PublicGistsFragment.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/gist/PublicGistsFragment.java rename to app/src/main/java/com/github/pockethub/ui/gist/PublicGistsFragment.java index 3a61e7a9e..bf45d19c5 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/PublicGistsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/PublicGistsFragment.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.gist.GistPager; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.gist.GistPager; import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.client.PageIterator; diff --git a/app/src/main/java/com/github/mobile/ui/gist/RandomGistTask.java b/app/src/main/java/com/github/pockethub/ui/gist/RandomGistTask.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/gist/RandomGistTask.java rename to app/src/main/java/com/github/pockethub/ui/gist/RandomGistTask.java index 5983639dc..f8ff0b010 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/RandomGistTask.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/RandomGistTask.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import static com.github.mobile.RequestCodes.GIST_VIEW; +import static com.github.pockethub.RequestCodes.GIST_VIEW; import android.accounts.Account; import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.core.gist.GistStore; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.gist.GistStore; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/gist/StarredGistsFragment.java b/app/src/main/java/com/github/pockethub/ui/gist/StarredGistsFragment.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/gist/StarredGistsFragment.java rename to app/src/main/java/com/github/pockethub/ui/gist/StarredGistsFragment.java index 4426c9a38..f034e1d4c 100644 --- a/app/src/main/java/com/github/mobile/ui/gist/StarredGistsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/StarredGistsFragment.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.gist; +package com.github.pockethub.ui.gist; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.gist.GistPager; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.gist.GistPager; import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.client.PageIterator; diff --git a/app/src/main/java/com/github/mobile/ui/issue/AssigneeDialog.java b/app/src/main/java/com/github/pockethub/ui/issue/AssigneeDialog.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/issue/AssigneeDialog.java rename to app/src/main/java/com/github/pockethub/ui/issue/AssigneeDialog.java index b9d80370d..50cda817d 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/AssigneeDialog.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/AssigneeDialog.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static java.lang.String.CASE_INSENSITIVE_ORDER; import android.accounts.Account; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/issue/AssigneeDialogFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/AssigneeDialogFragment.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/issue/AssigneeDialogFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/AssigneeDialogFragment.java index 6adee49bb..30fdbc1f3 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/AssigneeDialogFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/AssigneeDialogFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.app.Activity.RESULT_OK; import static android.content.DialogInterface.BUTTON_NEGATIVE; @@ -30,10 +30,10 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.SingleChoiceDialogFragment; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.SingleChoiceDialogFragment; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/issue/CreateCommentActivity.java b/app/src/main/java/com/github/pockethub/ui/issue/CreateCommentActivity.java similarity index 83% rename from app/src/main/java/com/github/mobile/ui/issue/CreateCommentActivity.java rename to app/src/main/java/com/github/pockethub/ui/issue/CreateCommentActivity.java index 69faff561..d2403ad80 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/CreateCommentActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/CreateCommentActivity.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; -import static com.github.mobile.Intents.EXTRA_ISSUE_NUMBER; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_NAME; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_OWNER; -import static com.github.mobile.Intents.EXTRA_USER; +import static com.github.pockethub.Intents.EXTRA_ISSUE_NUMBER; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_NAME; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_OWNER; +import static com.github.pockethub.Intents.EXTRA_USER; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.ui.comment.CommentPreviewPagerAdapter; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.ui.comment.CommentPreviewPagerAdapter; import org.eclipse.egit.github.core.Comment; import org.eclipse.egit.github.core.Issue; @@ -36,7 +36,7 @@ * Activity to create a comment on an {@link Issue} */ public class CreateCommentActivity extends - com.github.mobile.ui.comment.CreateCommentActivity { + com.github.pockethub.ui.comment.CreateCommentActivity { /** * Create intent to create a comment diff --git a/app/src/main/java/com/github/mobile/ui/issue/CreateCommentTask.java b/app/src/main/java/com/github/pockethub/ui/issue/CreateCommentTask.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/issue/CreateCommentTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/CreateCommentTask.java index 5a631c0c5..e82e09794 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/CreateCommentTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/CreateCommentTask.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.accounts.Account; import android.app.Activity; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.HtmlUtils; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.HtmlUtils; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/issue/CreateIssueTask.java b/app/src/main/java/com/github/pockethub/ui/issue/CreateIssueTask.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/issue/CreateIssueTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/CreateIssueTask.java index 6426d7213..10a92c57c 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/CreateIssueTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/CreateIssueTask.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.accounts.Account; import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/ui/issue/DashboardIssueFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueFragment.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/issue/DashboardIssueFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueFragment.java index a9d4aa39d..d8832b8d7 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/DashboardIssueFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueFragment.java @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; -import static com.github.mobile.RequestCodes.ISSUE_VIEW; +import static com.github.pockethub.RequestCodes.ISSUE_VIEW; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.ui.PagedItemFragment; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.ui.PagedItemFragment; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/issue/DashboardIssueListAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueListAdapter.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/issue/DashboardIssueListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueListAdapter.java index 6e84dcf4e..930510b74 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/DashboardIssueListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueListAdapter.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueUtils; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueUtils; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.RepositoryIssue; diff --git a/app/src/main/java/com/github/mobile/ui/issue/DeleteCommentTask.java b/app/src/main/java/com/github/pockethub/ui/issue/DeleteCommentTask.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/issue/DeleteCommentTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/DeleteCommentTask.java index 94fd849df..9f7d0e59f 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/DeleteCommentTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/DeleteCommentTask.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.accounts.Account; import android.app.Activity; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditAssigneeTask.java b/app/src/main/java/com/github/pockethub/ui/issue/EditAssigneeTask.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/issue/EditAssigneeTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditAssigneeTask.java index c882640b4..642462adc 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditAssigneeTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditAssigneeTask.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; -import static com.github.mobile.RequestCodes.ISSUE_ASSIGNEE_UPDATE; +import static com.github.pockethub.RequestCodes.ISSUE_ASSIGNEE_UPDATE; import android.accounts.Account; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditCommentActivity.java b/app/src/main/java/com/github/pockethub/ui/issue/EditCommentActivity.java similarity index 85% rename from app/src/main/java/com/github/mobile/ui/issue/EditCommentActivity.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditCommentActivity.java index 665b1281d..6a419de86 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditCommentActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditCommentActivity.java @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; -import static com.github.mobile.Intents.EXTRA_COMMENT; -import static com.github.mobile.Intents.EXTRA_ISSUE_NUMBER; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_NAME; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_OWNER; -import static com.github.mobile.Intents.EXTRA_USER; +import static com.github.pockethub.Intents.EXTRA_COMMENT; +import static com.github.pockethub.Intents.EXTRA_ISSUE_NUMBER; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_NAME; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_OWNER; +import static com.github.pockethub.Intents.EXTRA_USER; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.ui.comment.CommentPreviewPagerAdapter; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.ui.comment.CommentPreviewPagerAdapter; import org.eclipse.egit.github.core.Comment; import org.eclipse.egit.github.core.Issue; @@ -37,7 +37,7 @@ * Activity to edit a comment on an {@link Issue} */ public class EditCommentActivity extends - com.github.mobile.ui.comment.CreateCommentActivity { + com.github.pockethub.ui.comment.CreateCommentActivity { /** * Create intent to edit a comment diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditCommentTask.java b/app/src/main/java/com/github/pockethub/ui/issue/EditCommentTask.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/issue/EditCommentTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditCommentTask.java index ae443b5c4..8ce27a8e3 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditCommentTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditCommentTask.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.accounts.Account; import android.app.Activity; import android.content.Context; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.HtmlUtils; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.HtmlUtils; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Comment; diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java b/app/src/main/java/com/github/pockethub/ui/issue/EditIssueActivity.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditIssueActivity.java index b85d8f3fa..cbc13956e 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditIssueActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditIssueActivity.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.view.View.GONE; import static android.view.View.VISIBLE; -import static com.github.mobile.Intents.EXTRA_ISSUE; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_NAME; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_OWNER; -import static com.github.mobile.Intents.EXTRA_USER; -import static com.github.mobile.RequestCodes.ISSUE_ASSIGNEE_UPDATE; -import static com.github.mobile.RequestCodes.ISSUE_LABELS_UPDATE; -import static com.github.mobile.RequestCodes.ISSUE_MILESTONE_UPDATE; +import static com.github.pockethub.Intents.EXTRA_ISSUE; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_NAME; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_OWNER; +import static com.github.pockethub.Intents.EXTRA_USER; +import static com.github.pockethub.RequestCodes.ISSUE_ASSIGNEE_UPDATE; +import static com.github.pockethub.RequestCodes.ISSUE_LABELS_UPDATE; +import static com.github.pockethub.RequestCodes.ISSUE_MILESTONE_UPDATE; import android.accounts.Account; import android.content.Intent; import android.os.Bundle; @@ -39,15 +39,15 @@ import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.accounts.AuthenticatedUserTask; -import com.github.mobile.core.issue.IssueUtils; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.StyledText; -import com.github.mobile.ui.TextWatcherAdapter; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.accounts.AuthenticatedUserTask; +import com.github.pockethub.core.issue.IssueUtils; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.ui.TextWatcherAdapter; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditIssueTask.java b/app/src/main/java/com/github/pockethub/ui/issue/EditIssueTask.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/issue/EditIssueTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditIssueTask.java index e261fc59b..91f179d67 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditIssueTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditIssueTask.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.accounts.Account; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java b/app/src/main/java/com/github/pockethub/ui/issue/EditIssuesFilterActivity.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditIssuesFilterActivity.java index 3ce1f8a67..8cacfc101 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditIssuesFilterActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditIssuesFilterActivity.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.view.View.GONE; -import static com.github.mobile.Intents.EXTRA_ISSUE_FILTER; +import static com.github.pockethub.Intents.EXTRA_ISSUE_FILTER; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; @@ -30,11 +30,11 @@ import android.widget.RadioButton; import android.widget.TextView; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.Set; diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditLabelsTask.java b/app/src/main/java/com/github/pockethub/ui/issue/EditLabelsTask.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/issue/EditLabelsTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditLabelsTask.java index 0f465125a..df8fc8efb 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditLabelsTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditLabelsTask.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; -import static com.github.mobile.RequestCodes.ISSUE_LABELS_UPDATE; +import static com.github.pockethub.RequestCodes.ISSUE_LABELS_UPDATE; import android.accounts.Account; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import java.util.Arrays; diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditMilestoneTask.java b/app/src/main/java/com/github/pockethub/ui/issue/EditMilestoneTask.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/issue/EditMilestoneTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditMilestoneTask.java index aebf571a7..60ac3626b 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditMilestoneTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditMilestoneTask.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; -import static com.github.mobile.RequestCodes.ISSUE_MILESTONE_UPDATE; +import static com.github.pockethub.RequestCodes.ISSUE_MILESTONE_UPDATE; import android.accounts.Account; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/ui/issue/EditStateTask.java b/app/src/main/java/com/github/pockethub/ui/issue/EditStateTask.java similarity index 87% rename from app/src/main/java/com/github/mobile/ui/issue/EditStateTask.java rename to app/src/main/java/com/github/pockethub/ui/issue/EditStateTask.java index a3dd47b2d..867756fa9 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/EditStateTask.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/EditStateTask.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; -import static com.github.mobile.RequestCodes.ISSUE_CLOSE; -import static com.github.mobile.RequestCodes.ISSUE_REOPEN; +import static com.github.pockethub.RequestCodes.ISSUE_CLOSE; +import static com.github.pockethub.RequestCodes.ISSUE_REOPEN; import static org.eclipse.egit.github.core.service.IssueService.STATE_CLOSED; import static org.eclipse.egit.github.core.service.IssueService.STATE_OPEN; import android.accounts.Account; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.ui.ConfirmDialogFragment; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.ui.ConfirmDialogFragment; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; import com.google.inject.Inject; import org.eclipse.egit.github.core.IRepositoryIdProvider; diff --git a/app/src/main/java/com/github/mobile/ui/issue/FilterListAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/FilterListAdapter.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/issue/FilterListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/issue/FilterListAdapter.java index e0f6f4e55..e5ff9d6c7 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/FilterListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/FilterListAdapter.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.view.LayoutInflater; import android.widget.TextView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.util.AvatarLoader; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/issue/FilterListFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/FilterListFragment.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/issue/FilterListFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/FilterListFragment.java index e35e58078..0ea125a3d 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/FilterListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/FilterListFragment.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static java.lang.String.CASE_INSENSITIVE_ORDER; import android.os.Bundle; @@ -8,11 +8,11 @@ import com.github.kevinsawicki.wishlist.AsyncLoader; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.ui.ItemListFragment; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.persistence.AccountDataManager; +import com.github.pockethub.ui.ItemListFragment; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/issue/FiltersViewActivity.java b/app/src/main/java/com/github/pockethub/ui/issue/FiltersViewActivity.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/issue/FiltersViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/issue/FiltersViewActivity.java index e7b8cbf73..c0bff722d 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/FiltersViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/FiltersViewActivity.java @@ -13,27 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; -import android.util.TypedValue; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemLongClickListener; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.RequestFuture; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.ui.ConfirmDialogFragment; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.MainActivity; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.RequestFuture; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.persistence.AccountDataManager; +import com.github.pockethub.ui.ConfirmDialogFragment; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.MainActivity; import com.google.inject.Inject; /** diff --git a/app/src/main/java/com/github/mobile/ui/issue/FiltersViewFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/FiltersViewFragment.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/issue/FiltersViewFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/FiltersViewFragment.java index 9d0b4c161..3e5e667ce 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/FiltersViewFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/FiltersViewFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; @@ -28,18 +28,18 @@ import android.widget.AdapterView; import android.widget.AdapterView.OnItemLongClickListener; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.RequestFuture; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.ui.ConfirmDialogFragment; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.ui.MainActivity; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.RequestFuture; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.persistence.AccountDataManager; +import com.github.pockethub.ui.ConfirmDialogFragment; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.ui.MainActivity; import com.google.inject.Inject; /** - * Activity to display a list of saved {@link com.github.mobile.core.issue.IssueFilter} objects + * Activity to display a list of saved {@link com.github.pockethub.core.issue.IssueFilter} objects */ public class FiltersViewFragment extends DialogFragment implements OnItemLongClickListener { diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java b/app/src/main/java/com/github/pockethub/ui/issue/IssueBrowseActivity.java similarity index 86% rename from app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssueBrowseActivity.java index cea8817b3..dbf435c7c 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueBrowseActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssueBrowseActivity.java @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_ISSUE_FILTER; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_ISSUE_FILTER; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.view.MenuItem; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/IssueDashboardPagerAdapter.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssueDashboardPagerAdapter.java index 683770d33..e91388875 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssueDashboardPagerAdapter.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; -import static com.github.mobile.ui.issue.DashboardIssueFragment.ARG_FILTER; +import static com.github.pockethub.ui.issue.DashboardIssueFragment.ARG_FILTER; import static org.eclipse.egit.github.core.service.IssueService.DIRECTION_DESCENDING; import static org.eclipse.egit.github.core.service.IssueService.FIELD_DIRECTION; import static org.eclipse.egit.github.core.service.IssueService.FIELD_FILTER; @@ -29,8 +29,8 @@ import android.os.Bundle; import android.support.v4.app.Fragment; -import com.github.mobile.R; -import com.github.mobile.ui.FragmentStatePagerAdapter; +import com.github.pockethub.R; +import com.github.pockethub.ui.FragmentStatePagerAdapter; import java.io.Serializable; import java.util.HashMap; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/IssueDashboardPagerFragment.java similarity index 84% rename from app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssueDashboardPagerFragment.java index 09051533f..ccd87a98d 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssueDashboardPagerFragment.java @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.util.TypefaceUtils.ICON_ADD; -import static com.github.mobile.util.TypefaceUtils.ICON_BROADCAST; -import static com.github.mobile.util.TypefaceUtils.ICON_FOLLOW; -import static com.github.mobile.util.TypefaceUtils.ICON_WATCH; +import static com.github.pockethub.util.TypefaceUtils.ICON_ADD; +import static com.github.pockethub.util.TypefaceUtils.ICON_BROADCAST; +import static com.github.pockethub.util.TypefaceUtils.ICON_FOLLOW; +import static com.github.pockethub.util.TypefaceUtils.ICON_WATCH; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.MenuItem; import android.view.View; -import com.github.mobile.ui.MainActivity; -import com.github.mobile.ui.TabPagerFragment; +import com.github.pockethub.ui.MainActivity; +import com.github.pockethub.ui.TabPagerFragment; /** * Dashboard activity for issues diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/IssueFragment.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssueFragment.java index da5d170ab..2e88e7760 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssueFragment.java @@ -13,35 +13,34 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.app.Activity.RESULT_OK; import static android.view.View.GONE; import static android.view.View.VISIBLE; -import static com.github.mobile.Intents.EXTRA_COMMENT; -import static com.github.mobile.Intents.EXTRA_ISSUE; -import static com.github.mobile.Intents.EXTRA_ISSUE_NUMBER; -import static com.github.mobile.Intents.EXTRA_IS_COLLABORATOR; -import static com.github.mobile.Intents.EXTRA_IS_OWNER; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_NAME; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_OWNER; -import static com.github.mobile.Intents.EXTRA_USER; -import static com.github.mobile.RequestCodes.COMMENT_CREATE; -import static com.github.mobile.RequestCodes.COMMENT_DELETE; -import static com.github.mobile.RequestCodes.COMMENT_EDIT; -import static com.github.mobile.RequestCodes.ISSUE_ASSIGNEE_UPDATE; -import static com.github.mobile.RequestCodes.ISSUE_CLOSE; -import static com.github.mobile.RequestCodes.ISSUE_EDIT; -import static com.github.mobile.RequestCodes.ISSUE_LABELS_UPDATE; -import static com.github.mobile.RequestCodes.ISSUE_MILESTONE_UPDATE; -import static com.github.mobile.RequestCodes.ISSUE_REOPEN; -import static com.github.mobile.util.TypefaceUtils.ICON_COMMIT; +import static com.github.pockethub.Intents.EXTRA_COMMENT; +import static com.github.pockethub.Intents.EXTRA_ISSUE; +import static com.github.pockethub.Intents.EXTRA_ISSUE_NUMBER; +import static com.github.pockethub.Intents.EXTRA_IS_COLLABORATOR; +import static com.github.pockethub.Intents.EXTRA_IS_OWNER; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_NAME; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_OWNER; +import static com.github.pockethub.Intents.EXTRA_USER; +import static com.github.pockethub.RequestCodes.COMMENT_CREATE; +import static com.github.pockethub.RequestCodes.COMMENT_DELETE; +import static com.github.pockethub.RequestCodes.COMMENT_EDIT; +import static com.github.pockethub.RequestCodes.ISSUE_ASSIGNEE_UPDATE; +import static com.github.pockethub.RequestCodes.ISSUE_CLOSE; +import static com.github.pockethub.RequestCodes.ISSUE_EDIT; +import static com.github.pockethub.RequestCodes.ISSUE_LABELS_UPDATE; +import static com.github.pockethub.RequestCodes.ISSUE_MILESTONE_UPDATE; +import static com.github.pockethub.RequestCodes.ISSUE_REOPEN; +import static com.github.pockethub.util.TypefaceUtils.ICON_COMMIT; import static org.eclipse.egit.github.core.service.IssueService.STATE_OPEN; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; -import android.util.TypedValue; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -56,27 +55,27 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.core.issue.FullIssue; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.core.issue.IssueUtils; -import com.github.mobile.core.issue.RefreshIssueTask; -import com.github.mobile.ui.ConfirmDialogFragment; -import com.github.mobile.ui.DialogFragment; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.HeaderFooterListAdapter; -import com.github.mobile.ui.SelectableLinkMovementMethod; -import com.github.mobile.ui.StyledText; -import com.github.mobile.ui.comment.CommentListAdapter; -import com.github.mobile.ui.comment.DeleteCommentListener; -import com.github.mobile.ui.comment.EditCommentListener; -import com.github.mobile.ui.commit.CommitCompareViewActivity; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.HttpImageGetter; -import com.github.mobile.util.ShareUtils; -import com.github.mobile.util.ToastUtils; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.core.issue.FullIssue; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.core.issue.IssueUtils; +import com.github.pockethub.core.issue.RefreshIssueTask; +import com.github.pockethub.ui.ConfirmDialogFragment; +import com.github.pockethub.ui.DialogFragment; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.HeaderFooterListAdapter; +import com.github.pockethub.ui.SelectableLinkMovementMethod; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.ui.comment.CommentListAdapter; +import com.github.pockethub.ui.comment.DeleteCommentListener; +import com.github.pockethub.ui.comment.EditCommentListener; +import com.github.pockethub.ui.commit.CommitCompareViewActivity; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.HttpImageGetter; +import com.github.pockethub.util.ShareUtils; +import com.github.pockethub.util.ToastUtils; +import com.github.pockethub.util.TypefaceUtils; import com.google.inject.Inject; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueListAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/IssueListAdapter.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/issue/IssueListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssueListAdapter.java index c7ffc76f2..c8b766276 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssueListAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.graphics.Paint.STRIKE_THRU_TEXT_FLAG; import static org.eclipse.egit.github.core.service.IssueService.STATE_CLOSED; @@ -25,10 +25,10 @@ import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TypefaceUtils; import java.util.Date; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueSearchActivity.java b/app/src/main/java/com/github/pockethub/ui/issue/IssueSearchActivity.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/issue/IssueSearchActivity.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssueSearchActivity.java index dda283ca4..fb45c511c 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueSearchActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssueSearchActivity.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.app.SearchManager.APP_DATA; import static android.app.SearchManager.QUERY; import static android.content.Intent.ACTION_SEARCH; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.app.SearchManager; import android.content.Context; import android.content.Intent; @@ -31,11 +31,11 @@ import android.view.Menu; import android.view.MenuItem; -import com.github.mobile.R; -import com.github.mobile.ui.repo.RepositoryViewActivity; -import com.github.mobile.ui.roboactivities.RoboActionBarActivity; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.repo.RepositoryViewActivity; +import com.github.pockethub.ui.roboactivities.RoboActionBarActivity; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssueSearchSuggestionsProvider.java b/app/src/main/java/com/github/pockethub/ui/issue/IssueSearchSuggestionsProvider.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/issue/IssueSearchSuggestionsProvider.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssueSearchSuggestionsProvider.java index a34349eed..4e7cafcb2 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssueSearchSuggestionsProvider.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssueSearchSuggestionsProvider.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.content.Context; import android.content.SearchRecentSuggestionsProvider; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/IssuesFragment.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssuesFragment.java index e3bbd3d27..2038bc716 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssuesFragment.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.app.Activity.RESULT_OK; import static android.view.View.GONE; import static android.view.View.VISIBLE; -import static com.github.mobile.Intents.EXTRA_ISSUE; -import static com.github.mobile.Intents.EXTRA_ISSUE_FILTER; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; -import static com.github.mobile.RequestCodes.ISSUE_CREATE; -import static com.github.mobile.RequestCodes.ISSUE_FILTER_EDIT; -import static com.github.mobile.RequestCodes.ISSUE_VIEW; +import static com.github.pockethub.Intents.EXTRA_ISSUE; +import static com.github.pockethub.Intents.EXTRA_ISSUE_FILTER; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.RequestCodes.ISSUE_CREATE; +import static com.github.pockethub.RequestCodes.ISSUE_FILTER_EDIT; +import static com.github.pockethub.RequestCodes.ISSUE_VIEW; import android.app.Activity; import android.app.SearchManager; import android.content.Context; @@ -40,16 +40,16 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.RequestFuture; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.issue.IssueFilter; -import com.github.mobile.core.issue.IssuePager; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.ui.PagedItemFragment; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.RequestFuture; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.issue.IssueFilter; +import com.github.pockethub.core.issue.IssuePager; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.persistence.AccountDataManager; +import com.github.pockethub.ui.PagedItemFragment; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/IssuesPagerAdapter.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/issue/IssuesPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssuesPagerAdapter.java index 4f20f3f94..eda0f1b8b 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssuesPagerAdapter.java @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; - -import static com.github.mobile.Intents.EXTRA_ISSUE_NUMBER; -import static com.github.mobile.Intents.EXTRA_IS_COLLABORATOR; -import static com.github.mobile.Intents.EXTRA_IS_OWNER; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_NAME; -import static com.github.mobile.Intents.EXTRA_REPOSITORY_OWNER; -import static com.github.mobile.Intents.EXTRA_USER; +package com.github.pockethub.ui.issue; + +import static com.github.pockethub.Intents.EXTRA_ISSUE_NUMBER; +import static com.github.pockethub.Intents.EXTRA_IS_COLLABORATOR; +import static com.github.pockethub.Intents.EXTRA_IS_OWNER; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_NAME; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY_OWNER; +import static com.github.pockethub.Intents.EXTRA_USER; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.util.SparseArray; import android.view.ViewGroup; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.ui.FragmentStatePagerAdapter; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.ui.FragmentStatePagerAdapter; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java b/app/src/main/java/com/github/pockethub/ui/issue/IssuesViewActivity.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/issue/IssuesViewActivity.java index 706d256df..8f99f5085 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/IssuesViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssuesViewActivity.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_ISSUE_NUMBERS; -import static com.github.mobile.Intents.EXTRA_POSITION; -import static com.github.mobile.Intents.EXTRA_REPOSITORIES; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_ISSUE_NUMBERS; +import static com.github.pockethub.Intents.EXTRA_POSITION; +import static com.github.pockethub.Intents.EXTRA_REPOSITORIES; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.accounts.Account; import android.content.Intent; import android.os.Bundle; @@ -28,19 +28,19 @@ import android.view.Menu; import android.view.MenuItem; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.accounts.AuthenticatedUserTask; -import com.github.mobile.core.issue.IssueStore; -import com.github.mobile.core.issue.IssueUtils; -import com.github.mobile.core.repo.RefreshRepositoryTask; -import com.github.mobile.ui.FragmentProvider; -import com.github.mobile.ui.PagerActivity; -import com.github.mobile.ui.ViewPager; -import com.github.mobile.ui.repo.RepositoryViewActivity; -import com.github.mobile.ui.user.UriLauncherActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.accounts.AuthenticatedUserTask; +import com.github.pockethub.core.issue.IssueStore; +import com.github.pockethub.core.issue.IssueUtils; +import com.github.pockethub.core.repo.RefreshRepositoryTask; +import com.github.pockethub.ui.FragmentProvider; +import com.github.pockethub.ui.PagerActivity; +import com.github.pockethub.ui.ViewPager; +import com.github.pockethub.ui.repo.RepositoryViewActivity; +import com.github.pockethub.ui.user.UriLauncherActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/issue/LabelDrawableSpan.java b/app/src/main/java/com/github/pockethub/ui/issue/LabelDrawableSpan.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/issue/LabelDrawableSpan.java rename to app/src/main/java/com/github/pockethub/ui/issue/LabelDrawableSpan.java index 465d0d341..dcec9be57 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/LabelDrawableSpan.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/LabelDrawableSpan.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.graphics.Color.WHITE; import static android.graphics.Typeface.DEFAULT_BOLD; @@ -32,9 +32,9 @@ import android.text.style.DynamicDrawableSpan; import android.widget.TextView; -import com.github.mobile.R; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.ServiceUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.ServiceUtils; import java.util.Arrays; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/issue/LabelsDialog.java b/app/src/main/java/com/github/pockethub/ui/issue/LabelsDialog.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/issue/LabelsDialog.java rename to app/src/main/java/com/github/pockethub/ui/issue/LabelsDialog.java index 2953feeb0..0e07d66e3 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/LabelsDialog.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/LabelsDialog.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static java.lang.String.CASE_INSENSITIVE_ORDER; import android.accounts.Account; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import java.util.ArrayList; import java.util.Collection; diff --git a/app/src/main/java/com/github/mobile/ui/issue/LabelsDialogFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/LabelsDialogFragment.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/issue/LabelsDialogFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/LabelsDialogFragment.java index dc29d584f..b44b0afa4 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/LabelsDialogFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/LabelsDialogFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.app.Activity.RESULT_OK; import static android.content.DialogInterface.BUTTON_NEGATIVE; @@ -32,10 +32,10 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.DialogFragmentHelper; -import com.github.mobile.ui.LightAlertDialog; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.DialogFragmentHelper; +import com.github.pockethub.ui.LightAlertDialog; import java.util.ArrayList; import java.util.Arrays; diff --git a/app/src/main/java/com/github/mobile/ui/issue/MilestoneDialog.java b/app/src/main/java/com/github/pockethub/ui/issue/MilestoneDialog.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/issue/MilestoneDialog.java rename to app/src/main/java/com/github/pockethub/ui/issue/MilestoneDialog.java index b68d6aa3d..5793045df 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/MilestoneDialog.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/MilestoneDialog.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static java.lang.String.CASE_INSENSITIVE_ORDER; import static org.eclipse.egit.github.core.service.IssueService.STATE_CLOSED; @@ -21,10 +21,10 @@ import android.accounts.Account; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import java.util.ArrayList; import java.util.Collections; diff --git a/app/src/main/java/com/github/mobile/ui/issue/MilestoneDialogFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/MilestoneDialogFragment.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/issue/MilestoneDialogFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/MilestoneDialogFragment.java index 0ddf44af9..9ffa38fa6 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/MilestoneDialogFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/MilestoneDialogFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.app.Activity.RESULT_OK; import static android.content.DialogInterface.BUTTON_NEGATIVE; @@ -32,9 +32,9 @@ import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.SingleChoiceDialogFragment; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.SingleChoiceDialogFragment; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/issue/RepositoryIssueListAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/RepositoryIssueListAdapter.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/issue/RepositoryIssueListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/issue/RepositoryIssueListAdapter.java index 0d6c5a215..5b4c2bc2c 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/RepositoryIssueListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/RepositoryIssueListAdapter.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; -import com.github.mobile.R; -import com.github.mobile.core.issue.IssueUtils; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.issue.IssueUtils; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.Issue; diff --git a/app/src/main/java/com/github/mobile/ui/issue/SearchIssueListAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/SearchIssueListAdapter.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/issue/SearchIssueListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/issue/SearchIssueListAdapter.java index eda997638..eadca3280 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/SearchIssueListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/SearchIssueListAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import android.text.TextUtils; import android.view.LayoutInflater; @@ -21,9 +21,9 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.SearchIssue; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/issue/SearchIssueListFragment.java b/app/src/main/java/com/github/pockethub/ui/issue/SearchIssueListFragment.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/issue/SearchIssueListFragment.java rename to app/src/main/java/com/github/pockethub/ui/issue/SearchIssueListFragment.java index a12f9af97..4e9a36d8b 100644 --- a/app/src/main/java/com/github/mobile/ui/issue/SearchIssueListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/SearchIssueListFragment.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.issue; +package com.github.pockethub.ui.issue; import static android.app.SearchManager.APP_DATA; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import static org.eclipse.egit.github.core.service.IssueService.STATE_OPEN; import android.os.Bundle; import android.support.v4.content.Loader; @@ -24,10 +24,10 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.ui.ItemListFragment; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.ui.ItemListFragment; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java b/app/src/main/java/com/github/pockethub/ui/ref/BranchFileViewActivity.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/ref/BranchFileViewActivity.java index b442a509e..04122212d 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/BranchFileViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/ref/BranchFileViewActivity.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.ref; +package com.github.pockethub.ui.ref; import android.content.Intent; import android.os.Bundle; @@ -28,19 +28,19 @@ import android.widget.ProgressBar; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.code.RefreshBlobTask; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.ui.BaseActivity; -import com.github.mobile.ui.MarkdownLoader; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.HttpImageGetter; -import com.github.mobile.util.MarkdownUtils; -import com.github.mobile.util.PreferenceUtils; -import com.github.mobile.util.ShareUtils; -import com.github.mobile.util.SourceEditor; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.code.RefreshBlobTask; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.ui.BaseActivity; +import com.github.pockethub.ui.MarkdownLoader; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.HttpImageGetter; +import com.github.pockethub.util.MarkdownUtils; +import com.github.pockethub.util.PreferenceUtils; +import com.github.pockethub.util.ShareUtils; +import com.github.pockethub.util.SourceEditor; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Blob; @@ -48,12 +48,12 @@ import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.util.EncodingUtils; -import static com.github.mobile.Intents.EXTRA_BASE; -import static com.github.mobile.Intents.EXTRA_HEAD; -import static com.github.mobile.Intents.EXTRA_PATH; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; -import static com.github.mobile.util.PreferenceUtils.RENDER_MARKDOWN; -import static com.github.mobile.util.PreferenceUtils.WRAP; +import static com.github.pockethub.Intents.EXTRA_BASE; +import static com.github.pockethub.Intents.EXTRA_HEAD; +import static com.github.pockethub.Intents.EXTRA_PATH; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.util.PreferenceUtils.RENDER_MARKDOWN; +import static com.github.pockethub.util.PreferenceUtils.WRAP; /** * Activity to view a file on a branch diff --git a/app/src/main/java/com/github/mobile/ui/ref/CodeTreeAdapter.java b/app/src/main/java/com/github/pockethub/ui/ref/CodeTreeAdapter.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/ref/CodeTreeAdapter.java rename to app/src/main/java/com/github/pockethub/ui/ref/CodeTreeAdapter.java index 3f196f0d8..7453e3be4 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/CodeTreeAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/ref/CodeTreeAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.ref; +package com.github.pockethub.ui.ref; import android.app.Activity; import android.content.Context; @@ -22,12 +22,12 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.MultiTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.core.code.FullTree.Entry; -import com.github.mobile.core.code.FullTree.Folder; -import com.github.mobile.core.commit.CommitUtils; -import com.github.mobile.util.ServiceUtils; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.code.FullTree.Entry; +import com.github.pockethub.core.code.FullTree.Folder; +import com.github.pockethub.core.commit.CommitUtils; +import com.github.pockethub.util.ServiceUtils; +import com.github.pockethub.util.TypefaceUtils; /** * Adapter to display a source code tree diff --git a/app/src/main/java/com/github/mobile/ui/ref/RefDialog.java b/app/src/main/java/com/github/pockethub/ui/ref/RefDialog.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/ref/RefDialog.java rename to app/src/main/java/com/github/pockethub/ui/ref/RefDialog.java index 56c102e91..29442bb99 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/RefDialog.java +++ b/app/src/main/java/com/github/pockethub/ui/ref/RefDialog.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.ref; +package com.github.pockethub.ui.ref; import static java.lang.String.CASE_INSENSITIVE_ORDER; import android.accounts.Account; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.core.ref.RefUtils; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.ProgressDialogTask; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.ref.RefUtils; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.ProgressDialogTask; +import com.github.pockethub.util.ToastUtils; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/ref/RefDialogFragment.java b/app/src/main/java/com/github/pockethub/ui/ref/RefDialogFragment.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/ref/RefDialogFragment.java rename to app/src/main/java/com/github/pockethub/ui/ref/RefDialogFragment.java index d10b22c81..21e554870 100644 --- a/app/src/main/java/com/github/mobile/ui/ref/RefDialogFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/ref/RefDialogFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.ref; +package com.github.pockethub.ui.ref; import static android.app.Activity.RESULT_OK; import static android.content.DialogInterface.BUTTON_NEGATIVE; @@ -29,11 +29,11 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.core.ref.RefUtils; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.ui.SingleChoiceDialogFragment; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.core.ref.RefUtils; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.ui.SingleChoiceDialogFragment; +import com.github.pockethub.util.TypefaceUtils; import java.util.ArrayList; diff --git a/app/src/main/java/com/github/mobile/ui/repo/ContributorListAdapter.java b/app/src/main/java/com/github/pockethub/ui/repo/ContributorListAdapter.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/repo/ContributorListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/repo/ContributorListAdapter.java index 3ce14e8b4..98ae1857a 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/ContributorListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/ContributorListAdapter.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; import android.content.Context; import android.view.LayoutInflater; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.util.AvatarLoader; import org.eclipse.egit.github.core.Contributor; diff --git a/app/src/main/java/com/github/mobile/ui/repo/DefaultRepositoryListAdapter.java b/app/src/main/java/com/github/pockethub/ui/repo/DefaultRepositoryListAdapter.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/repo/DefaultRepositoryListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/repo/DefaultRepositoryListAdapter.java index 356d1d450..5beafa319 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/DefaultRepositoryListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/DefaultRepositoryListAdapter.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; -import com.github.mobile.R; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.TypefaceUtils; import java.util.HashMap; import java.util.HashSet; diff --git a/app/src/main/java/com/github/mobile/ui/repo/OrganizationLoader.java b/app/src/main/java/com/github/pockethub/ui/repo/OrganizationLoader.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/repo/OrganizationLoader.java rename to app/src/main/java/com/github/pockethub/ui/repo/OrganizationLoader.java index 72ae6caaf..f1138c769 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/OrganizationLoader.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/OrganizationLoader.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; import android.accounts.Account; import android.app.Activity; import android.util.Log; -import com.github.mobile.R; -import com.github.mobile.accounts.AuthenticatedUserLoader; -import com.github.mobile.core.user.UserComparator; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AuthenticatedUserLoader; +import com.github.pockethub.core.user.UserComparator; +import com.github.pockethub.persistence.AccountDataManager; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import com.google.inject.Provider; diff --git a/app/src/main/java/com/github/mobile/ui/repo/RecentRepositories.java b/app/src/main/java/com/github/pockethub/ui/repo/RecentRepositories.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/repo/RecentRepositories.java rename to app/src/main/java/com/github/pockethub/ui/repo/RecentRepositories.java index 2f464b1be..49cad0907 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RecentRepositories.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/RecentRepositories.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; import static java.lang.String.CASE_INSENSITIVE_ORDER; import android.content.Context; import android.os.AsyncTask; -import com.github.mobile.RequestReader; -import com.github.mobile.RequestWriter; +import com.github.pockethub.RequestReader; +import com.github.pockethub.RequestWriter; import java.io.File; import java.io.Serializable; diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsActivity.java b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryContributorsActivity.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsActivity.java rename to app/src/main/java/com/github/pockethub/ui/repo/RepositoryContributorsActivity.java index 5b13df83b..1cb0866de 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryContributorsActivity.java @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.view.MenuItem; -import com.github.mobile.Intents; -import com.github.mobile.R; -import com.github.mobile.ui.DialogFragmentActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.Intents; +import com.github.pockethub.R; +import com.github.pockethub.ui.DialogFragmentActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsFragment.java b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryContributorsFragment.java similarity index 87% rename from app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsFragment.java rename to app/src/main/java/com/github/pockethub/ui/repo/RepositoryContributorsFragment.java index a9cfc84bc..ba4614f5c 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryContributorsFragment.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.app.Activity; import android.os.Bundle; import android.support.v4.content.Loader; @@ -23,13 +23,13 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.core.user.RefreshUserTask; -import com.github.mobile.ui.ItemListFragment; -import com.github.mobile.ui.user.UserViewActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.core.user.RefreshUserTask; +import com.github.pockethub.ui.ItemListFragment; +import com.github.pockethub.ui.user.UserViewActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListAdapter.java b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryListAdapter.java similarity index 86% rename from app/src/main/java/com/github/mobile/ui/repo/RepositoryListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/repo/RepositoryListAdapter.java index cd76384f5..8c42dc4b8 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryListAdapter.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; -import static com.github.mobile.util.TypefaceUtils.ICON_FORK; -import static com.github.mobile.util.TypefaceUtils.ICON_MIRROR_PRIVATE; -import static com.github.mobile.util.TypefaceUtils.ICON_MIRROR_PUBLIC; -import static com.github.mobile.util.TypefaceUtils.ICON_PRIVATE; -import static com.github.mobile.util.TypefaceUtils.ICON_PUBLIC; +import static com.github.pockethub.util.TypefaceUtils.ICON_FORK; +import static com.github.pockethub.util.TypefaceUtils.ICON_MIRROR_PRIVATE; +import static com.github.pockethub.util.TypefaceUtils.ICON_MIRROR_PUBLIC; +import static com.github.pockethub.util.TypefaceUtils.ICON_PRIVATE; +import static com.github.pockethub.util.TypefaceUtils.ICON_PUBLIC; import android.text.TextUtils; import android.view.LayoutInflater; diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryListFragment.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java rename to app/src/main/java/com/github/pockethub/ui/repo/RepositoryListFragment.java index 029eadc6d..69b3b839e 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryListFragment.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; -import static com.github.mobile.Intents.EXTRA_USER; -import static com.github.mobile.RequestCodes.REPOSITORY_VIEW; -import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; +import static com.github.pockethub.Intents.EXTRA_USER; +import static com.github.pockethub.RequestCodes.REPOSITORY_VIEW; +import static com.github.pockethub.ResultCodes.RESOURCE_CHANGED; import static java.util.Locale.US; import android.app.Activity; import android.app.AlertDialog; @@ -30,16 +30,16 @@ import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewFinder; -import com.github.mobile.R; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.persistence.AccountDataManager; -import com.github.mobile.ui.HeaderFooterListAdapter; -import com.github.mobile.ui.ItemListFragment; -import com.github.mobile.ui.LightAlertDialog; -import com.github.mobile.ui.user.OrganizationSelectionListener; -import com.github.mobile.ui.user.OrganizationSelectionProvider; -import com.github.mobile.ui.user.UserViewActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.persistence.AccountDataManager; +import com.github.pockethub.ui.HeaderFooterListAdapter; +import com.github.pockethub.ui.ItemListFragment; +import com.github.pockethub.ui.LightAlertDialog; +import com.github.pockethub.ui.user.OrganizationSelectionListener; +import com.github.pockethub.ui.user.OrganizationSelectionProvider; +import com.github.pockethub.ui.user.UserViewActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.Collections; diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryNewsFragment.java similarity index 84% rename from app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java rename to app/src/main/java/com/github/pockethub/ui/repo/RepositoryNewsFragment.java index e0bc79138..c57fdf185 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryNewsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryNewsFragment.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; import android.app.Activity; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.user.UserEventMatcher.UserPair; -import com.github.mobile.ui.NewsFragment; -import com.github.mobile.ui.issue.IssuesViewActivity; -import com.github.mobile.ui.user.EventPager; -import com.github.mobile.ui.user.UserViewActivity; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.user.UserEventMatcher.UserPair; +import com.github.pockethub.ui.NewsFragment; +import com.github.pockethub.ui.issue.IssuesViewActivity; +import com.github.pockethub.ui.user.EventPager; +import com.github.pockethub.ui.user.UserViewActivity; import org.eclipse.egit.github.core.Issue; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryPagerAdapter.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/repo/RepositoryPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/repo/RepositoryPagerAdapter.java index 5d499f530..7193705d7 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryPagerAdapter.java @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; import android.content.res.Resources; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; -import com.github.mobile.R; -import com.github.mobile.ui.FragmentPagerAdapter; -import com.github.mobile.ui.code.RepositoryCodeFragment; -import com.github.mobile.ui.commit.CommitListFragment; -import com.github.mobile.ui.issue.IssuesFragment; +import com.github.pockethub.R; +import com.github.pockethub.ui.FragmentPagerAdapter; +import com.github.pockethub.ui.code.RepositoryCodeFragment; +import com.github.pockethub.ui.commit.CommitListFragment; +import com.github.pockethub.ui.issue.IssuesFragment; /** * Adapter to view a repository's various pages diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryViewActivity.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/repo/RepositoryViewActivity.java index 73c0f27b5..deec4086b 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/RepositoryViewActivity.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_REPOSITORY; -import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; -import static com.github.mobile.ui.repo.RepositoryPagerAdapter.ITEM_CODE; -import static com.github.mobile.util.TypefaceUtils.ICON_CODE; -import static com.github.mobile.util.TypefaceUtils.ICON_COMMIT; -import static com.github.mobile.util.TypefaceUtils.ICON_ISSUE_OPEN; -import static com.github.mobile.util.TypefaceUtils.ICON_NEWS; +import static com.github.pockethub.Intents.EXTRA_REPOSITORY; +import static com.github.pockethub.ResultCodes.RESOURCE_CHANGED; +import static com.github.pockethub.ui.repo.RepositoryPagerAdapter.ITEM_CODE; +import static com.github.pockethub.util.TypefaceUtils.ICON_CODE; +import static com.github.pockethub.util.TypefaceUtils.ICON_COMMIT; +import static com.github.pockethub.util.TypefaceUtils.ICON_ISSUE_OPEN; +import static com.github.pockethub.util.TypefaceUtils.ICON_NEWS; import android.content.Intent; import android.net.Uri; import android.os.Bundle; @@ -35,21 +35,21 @@ import com.afollestad.materialdialogs.MaterialDialog; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.repo.DeleteRepositoryTask; -import com.github.mobile.core.repo.ForkRepositoryTask; -import com.github.mobile.core.repo.RefreshRepositoryTask; -import com.github.mobile.core.repo.RepositoryUtils; -import com.github.mobile.core.repo.StarRepositoryTask; -import com.github.mobile.core.repo.StarredRepositoryTask; -import com.github.mobile.core.repo.UnstarRepositoryTask; -import com.github.mobile.ui.TabPagerActivity; -import com.github.mobile.ui.user.UriLauncherActivity; -import com.github.mobile.ui.user.UserViewActivity; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.ShareUtils; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.repo.DeleteRepositoryTask; +import com.github.pockethub.core.repo.ForkRepositoryTask; +import com.github.pockethub.core.repo.RefreshRepositoryTask; +import com.github.pockethub.core.repo.RepositoryUtils; +import com.github.pockethub.core.repo.StarRepositoryTask; +import com.github.pockethub.core.repo.StarredRepositoryTask; +import com.github.pockethub.core.repo.UnstarRepositoryTask; +import com.github.pockethub.ui.TabPagerActivity; +import com.github.pockethub.ui.user.UriLauncherActivity; +import com.github.pockethub.ui.user.UserViewActivity; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.ShareUtils; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.Repository; diff --git a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListAdapter.java b/app/src/main/java/com/github/pockethub/ui/repo/UserRepositoryListAdapter.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/repo/UserRepositoryListAdapter.java index 2ffeca053..3d74e36d8 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/UserRepositoryListAdapter.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; -import com.github.mobile.R; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java b/app/src/main/java/com/github/pockethub/ui/repo/UserRepositoryListFragment.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java rename to app/src/main/java/com/github/pockethub/ui/repo/UserRepositoryListFragment.java index d5c9be213..ee6c62b6f 100644 --- a/app/src/main/java/com/github/mobile/ui/repo/UserRepositoryListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/repo/UserRepositoryListFragment.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.repo; +package com.github.pockethub.ui.repo; -import static com.github.mobile.Intents.EXTRA_USER; -import static com.github.mobile.RequestCodes.REPOSITORY_VIEW; -import static com.github.mobile.ResultCodes.RESOURCE_CHANGED; +import static com.github.pockethub.Intents.EXTRA_USER; +import static com.github.pockethub.RequestCodes.REPOSITORY_VIEW; +import static com.github.pockethub.ResultCodes.RESOURCE_CHANGED; import android.app.Activity; import android.content.Intent; import android.os.Bundle; @@ -25,9 +25,9 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.ui.PagedItemFragment; +import com.github.pockethub.R; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.ui.PagedItemFragment; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/roboactivities/ActionBarAccountAuthenticatorActivity.java b/app/src/main/java/com/github/pockethub/ui/roboactivities/ActionBarAccountAuthenticatorActivity.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/roboactivities/ActionBarAccountAuthenticatorActivity.java rename to app/src/main/java/com/github/pockethub/ui/roboactivities/ActionBarAccountAuthenticatorActivity.java index d23e022fb..c504de7ff 100644 --- a/app/src/main/java/com/github/mobile/ui/roboactivities/ActionBarAccountAuthenticatorActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/roboactivities/ActionBarAccountAuthenticatorActivity.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui.roboactivities; +package com.github.pockethub.ui.roboactivities; import android.accounts.AccountAuthenticatorResponse; import android.accounts.AccountManager; diff --git a/app/src/main/java/com/github/mobile/ui/roboactivities/RoboActionBarAccountAuthenticatorActivity.java b/app/src/main/java/com/github/pockethub/ui/roboactivities/RoboActionBarAccountAuthenticatorActivity.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/roboactivities/RoboActionBarAccountAuthenticatorActivity.java rename to app/src/main/java/com/github/pockethub/ui/roboactivities/RoboActionBarAccountAuthenticatorActivity.java index ff7735e95..62c568d85 100644 --- a/app/src/main/java/com/github/mobile/ui/roboactivities/RoboActionBarAccountAuthenticatorActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/roboactivities/RoboActionBarAccountAuthenticatorActivity.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui.roboactivities; +package com.github.pockethub.ui.roboactivities; import android.accounts.AccountAuthenticatorActivity; import android.content.Intent; diff --git a/app/src/main/java/com/github/mobile/ui/roboactivities/RoboActionBarActivity.java b/app/src/main/java/com/github/pockethub/ui/roboactivities/RoboActionBarActivity.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/roboactivities/RoboActionBarActivity.java rename to app/src/main/java/com/github/pockethub/ui/roboactivities/RoboActionBarActivity.java index 19769a727..0d579b122 100644 --- a/app/src/main/java/com/github/mobile/ui/roboactivities/RoboActionBarActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/roboactivities/RoboActionBarActivity.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui.roboactivities; +package com.github.pockethub.ui.roboactivities; import android.content.Intent; import android.content.res.Configuration; diff --git a/app/src/main/java/com/github/mobile/ui/roboactivities/RoboSupportFragment.java b/app/src/main/java/com/github/pockethub/ui/roboactivities/RoboSupportFragment.java similarity index 92% rename from app/src/main/java/com/github/mobile/ui/roboactivities/RoboSupportFragment.java rename to app/src/main/java/com/github/pockethub/ui/roboactivities/RoboSupportFragment.java index 8fe76de32..941bc7961 100644 --- a/app/src/main/java/com/github/mobile/ui/roboactivities/RoboSupportFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/roboactivities/RoboSupportFragment.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui.roboactivities; +package com.github.pockethub.ui.roboactivities; import roboguice.RoboGuice; import android.os.Bundle; diff --git a/app/src/main/java/com/github/mobile/ui/search/RepositorySearchSuggestionsProvider.java b/app/src/main/java/com/github/pockethub/ui/search/RepositorySearchSuggestionsProvider.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/search/RepositorySearchSuggestionsProvider.java rename to app/src/main/java/com/github/pockethub/ui/search/RepositorySearchSuggestionsProvider.java index bbcc6346b..c3987b90b 100644 --- a/app/src/main/java/com/github/mobile/ui/search/RepositorySearchSuggestionsProvider.java +++ b/app/src/main/java/com/github/pockethub/ui/search/RepositorySearchSuggestionsProvider.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.search; +package com.github.pockethub.ui.search; import android.content.Context; import android.content.SearchRecentSuggestionsProvider; diff --git a/app/src/main/java/com/github/mobile/ui/search/SearchActivity.java b/app/src/main/java/com/github/pockethub/ui/search/SearchActivity.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/search/SearchActivity.java rename to app/src/main/java/com/github/pockethub/ui/search/SearchActivity.java index d448b0d05..c1da86712 100644 --- a/app/src/main/java/com/github/mobile/ui/search/SearchActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/search/SearchActivity.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.search; +package com.github.pockethub.ui.search; import static android.app.SearchManager.QUERY; import static android.content.Intent.ACTION_SEARCH; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.util.TypefaceUtils.ICON_PERSON; -import static com.github.mobile.util.TypefaceUtils.ICON_PUBLIC; +import static com.github.pockethub.util.TypefaceUtils.ICON_PERSON; +import static com.github.pockethub.util.TypefaceUtils.ICON_PUBLIC; import android.app.SearchManager; import android.content.Context; import android.content.Intent; @@ -34,10 +34,10 @@ import android.widget.ProgressBar; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.R; -import com.github.mobile.ui.MainActivity; -import com.github.mobile.ui.TabPagerActivity; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.MainActivity; +import com.github.pockethub.ui.TabPagerActivity; +import com.github.pockethub.util.ToastUtils; /** * Activity to view search results diff --git a/app/src/main/java/com/github/mobile/ui/search/SearchPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/search/SearchPagerAdapter.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/search/SearchPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/search/SearchPagerAdapter.java index c485547a2..36170441b 100644 --- a/app/src/main/java/com/github/mobile/ui/search/SearchPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/search/SearchPagerAdapter.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.search; +package com.github.pockethub.ui.search; import android.content.res.Resources; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; -import com.github.mobile.R; -import com.github.mobile.ui.FragmentPagerAdapter; +import com.github.pockethub.R; +import com.github.pockethub.ui.FragmentPagerAdapter; /** * Adapter to view various pages of search screen diff --git a/app/src/main/java/com/github/mobile/ui/search/SearchRepositoryListAdapter.java b/app/src/main/java/com/github/pockethub/ui/search/SearchRepositoryListAdapter.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/search/SearchRepositoryListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/search/SearchRepositoryListAdapter.java index ef6054a91..066fa707e 100644 --- a/app/src/main/java/com/github/mobile/ui/search/SearchRepositoryListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/search/SearchRepositoryListAdapter.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.search; +package com.github.pockethub.ui.search; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; -import com.github.mobile.R; -import com.github.mobile.ui.StyledText; -import com.github.mobile.ui.repo.RepositoryListAdapter; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.ui.repo.RepositoryListAdapter; +import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.SearchRepository; diff --git a/app/src/main/java/com/github/mobile/ui/search/SearchRepositoryListFragment.java b/app/src/main/java/com/github/pockethub/ui/search/SearchRepositoryListFragment.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/search/SearchRepositoryListFragment.java rename to app/src/main/java/com/github/pockethub/ui/search/SearchRepositoryListFragment.java index 96a009a24..26d630c99 100644 --- a/app/src/main/java/com/github/mobile/ui/search/SearchRepositoryListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/search/SearchRepositoryListFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.search; +package com.github.pockethub.ui.search; import static android.app.SearchManager.QUERY; import android.app.Activity; @@ -24,11 +24,11 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.core.repo.RefreshRepositoryTask; -import com.github.mobile.ui.ItemListFragment; -import com.github.mobile.ui.repo.RepositoryViewActivity; +import com.github.pockethub.R; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.core.repo.RefreshRepositoryTask; +import com.github.pockethub.ui.ItemListFragment; +import com.github.pockethub.ui.repo.RepositoryViewActivity; import com.google.inject.Inject; import java.io.IOException; diff --git a/app/src/main/java/com/github/mobile/ui/search/SearchUserListAdapter.java b/app/src/main/java/com/github/pockethub/ui/search/SearchUserListAdapter.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/search/SearchUserListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/search/SearchUserListAdapter.java index 8199e1e93..53acd8a4e 100644 --- a/app/src/main/java/com/github/mobile/ui/search/SearchUserListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/search/SearchUserListAdapter.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.search; +package com.github.pockethub.ui.search; import android.content.Context; import android.view.LayoutInflater; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.core.search.SearchUser; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.core.search.SearchUser; +import com.github.pockethub.util.AvatarLoader; /** * Adapter for a list of searched users diff --git a/app/src/main/java/com/github/mobile/ui/search/SearchUserListFragment.java b/app/src/main/java/com/github/pockethub/ui/search/SearchUserListFragment.java similarity index 85% rename from app/src/main/java/com/github/mobile/ui/search/SearchUserListFragment.java rename to app/src/main/java/com/github/pockethub/ui/search/SearchUserListFragment.java index 0a2c7f8a5..4fd90b8b3 100644 --- a/app/src/main/java/com/github/mobile/ui/search/SearchUserListFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/search/SearchUserListFragment.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.search; +package com.github.pockethub.ui.search; import static android.app.SearchManager.QUERY; import android.app.Activity; @@ -23,15 +23,15 @@ import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.core.search.SearchUser; -import com.github.mobile.core.search.SearchUserService; -import com.github.mobile.core.user.RefreshUserTask; -import com.github.mobile.ui.ItemListFragment; -import com.github.mobile.ui.user.UserViewActivity; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.core.search.SearchUser; +import com.github.pockethub.core.search.SearchUserService; +import com.github.pockethub.core.user.RefreshUserTask; +import com.github.pockethub.ui.ItemListFragment; +import com.github.pockethub.ui.user.UserViewActivity; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/user/EventPager.java b/app/src/main/java/com/github/pockethub/ui/user/EventPager.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/user/EventPager.java rename to app/src/main/java/com/github/pockethub/ui/user/EventPager.java index 33b725970..268802903 100644 --- a/app/src/main/java/com/github/mobile/ui/user/EventPager.java +++ b/app/src/main/java/com/github/pockethub/ui/user/EventPager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.core.ResourcePager; import org.eclipse.egit.github.core.event.Event; diff --git a/app/src/main/java/com/github/mobile/ui/user/EventType.java b/app/src/main/java/com/github/pockethub/ui/user/EventType.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/user/EventType.java rename to app/src/main/java/com/github/pockethub/ui/user/EventType.java index 5d92b4254..da2e606f4 100644 --- a/app/src/main/java/com/github/mobile/ui/user/EventType.java +++ b/app/src/main/java/com/github/pockethub/ui/user/EventType.java @@ -1,7 +1,7 @@ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.event.Event; import org.eclipse.egit.github.core.event.IssuesPayload; diff --git a/app/src/main/java/com/github/mobile/ui/user/FollowersFragment.java b/app/src/main/java/com/github/pockethub/ui/user/FollowersFragment.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/user/FollowersFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/FollowersFragment.java index e35c5744c..84373ef3f 100644 --- a/app/src/main/java/com/github/mobile/ui/user/FollowersFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/FollowersFragment.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.os.Bundle; -import com.github.mobile.R; +import com.github.pockethub.R; /** diff --git a/app/src/main/java/com/github/mobile/ui/user/FollowingFragment.java b/app/src/main/java/com/github/pockethub/ui/user/FollowingFragment.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/user/FollowingFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/FollowingFragment.java index da91359ed..1f2696905 100644 --- a/app/src/main/java/com/github/mobile/ui/user/FollowingFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/FollowingFragment.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.os.Bundle; -import com.github.mobile.R; +import com.github.pockethub.R; /** diff --git a/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/user/HomePagerAdapter.java similarity index 94% rename from app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/user/HomePagerAdapter.java index f0959bd17..cc1eaa1de 100644 --- a/app/src/main/java/com/github/mobile/ui/user/HomePagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/user/HomePagerAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.content.res.Resources; import android.os.Bundle; @@ -21,9 +21,9 @@ import android.support.v4.app.FragmentManager; import android.view.ViewGroup; -import com.github.mobile.R; -import com.github.mobile.ui.FragmentPagerAdapter; -import com.github.mobile.ui.repo.RepositoryListFragment; +import com.github.pockethub.R; +import com.github.pockethub.ui.FragmentPagerAdapter; +import com.github.pockethub.ui.repo.RepositoryListFragment; import java.util.HashSet; import java.util.Set; diff --git a/app/src/main/java/com/github/mobile/ui/user/HomePagerFragment.java b/app/src/main/java/com/github/pockethub/ui/user/HomePagerFragment.java similarity index 86% rename from app/src/main/java/com/github/mobile/ui/user/HomePagerFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/HomePagerFragment.java index 21288406f..df584d6c6 100644 --- a/app/src/main/java/com/github/mobile/ui/user/HomePagerFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/HomePagerFragment.java @@ -1,4 +1,4 @@ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.content.Context; import android.content.SharedPreferences; @@ -6,9 +6,9 @@ import android.support.annotation.Nullable; import android.view.View; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.ui.TabPagerFragment; -import com.github.mobile.util.PreferenceUtils; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.ui.TabPagerFragment; +import com.github.pockethub.util.PreferenceUtils; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/user/IconAndViewTextManager.java b/app/src/main/java/com/github/pockethub/ui/user/IconAndViewTextManager.java similarity index 98% rename from app/src/main/java/com/github/mobile/ui/user/IconAndViewTextManager.java rename to app/src/main/java/com/github/pockethub/ui/user/IconAndViewTextManager.java index 4e80e3752..f2f5b2556 100644 --- a/app/src/main/java/com/github/mobile/ui/user/IconAndViewTextManager.java +++ b/app/src/main/java/com/github/pockethub/ui/user/IconAndViewTextManager.java @@ -1,11 +1,11 @@ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.text.TextUtils; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.core.issue.IssueUtils; -import com.github.mobile.ui.StyledText; -import com.github.mobile.util.TimeUtils; +import com.github.pockethub.core.issue.IssueUtils; +import com.github.pockethub.ui.StyledText; +import com.github.pockethub.util.TimeUtils; import org.eclipse.egit.github.core.Comment; import org.eclipse.egit.github.core.Commit; diff --git a/app/src/main/java/com/github/mobile/ui/user/MembersFragment.java b/app/src/main/java/com/github/pockethub/ui/user/MembersFragment.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/user/MembersFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/MembersFragment.java index 10659286a..3be2ed696 100644 --- a/app/src/main/java/com/github/mobile/ui/user/MembersFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/MembersFragment.java @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import static com.github.mobile.Intents.EXTRA_USER; +import static com.github.pockethub.Intents.EXTRA_USER; import android.os.Bundle; import android.support.v4.content.Loader; import android.view.View; import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.ThrowableLoader; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.ui.ItemListFragment; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.ThrowableLoader; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.ui.ItemListFragment; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/user/MyFollowersFragment.java b/app/src/main/java/com/github/pockethub/ui/user/MyFollowersFragment.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/user/MyFollowersFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/MyFollowersFragment.java index 9b8fd37e5..e999dd7b3 100644 --- a/app/src/main/java/com/github/mobile/ui/user/MyFollowersFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/MyFollowersFragment.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.user.UserPager; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.user.UserPager; import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; diff --git a/app/src/main/java/com/github/mobile/ui/user/MyFollowingFragment.java b/app/src/main/java/com/github/pockethub/ui/user/MyFollowingFragment.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/user/MyFollowingFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/MyFollowingFragment.java index c60e38f0b..d3821b56c 100644 --- a/app/src/main/java/com/github/mobile/ui/user/MyFollowingFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/MyFollowingFragment.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.user.UserPager; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.user.UserPager; import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; diff --git a/app/src/main/java/com/github/mobile/ui/user/NewsListAdapter.java b/app/src/main/java/com/github/pockethub/ui/user/NewsListAdapter.java similarity index 97% rename from app/src/main/java/com/github/mobile/ui/user/NewsListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/user/NewsListAdapter.java index fb5bb4787..55b8072e1 100644 --- a/app/src/main/java/com/github/mobile/ui/user/NewsListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/user/NewsListAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.text.TextUtils; import android.view.LayoutInflater; @@ -22,9 +22,9 @@ import android.widget.TextView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.R; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.event.CreatePayload; import org.eclipse.egit.github.core.event.Event; diff --git a/app/src/main/java/com/github/mobile/ui/user/OrganizationNewsFragment.java b/app/src/main/java/com/github/pockethub/ui/user/OrganizationNewsFragment.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/user/OrganizationNewsFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/OrganizationNewsFragment.java index a657cb528..317ea4f81 100644 --- a/app/src/main/java/com/github/mobile/ui/user/OrganizationNewsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/OrganizationNewsFragment.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.core.ResourcePager; import org.eclipse.egit.github.core.client.PageIterator; import org.eclipse.egit.github.core.event.Event; diff --git a/app/src/main/java/com/github/mobile/ui/user/OrganizationSelectionListener.java b/app/src/main/java/com/github/pockethub/ui/user/OrganizationSelectionListener.java similarity index 95% rename from app/src/main/java/com/github/mobile/ui/user/OrganizationSelectionListener.java rename to app/src/main/java/com/github/pockethub/ui/user/OrganizationSelectionListener.java index f5cbad8d4..9e715ab9e 100644 --- a/app/src/main/java/com/github/mobile/ui/user/OrganizationSelectionListener.java +++ b/app/src/main/java/com/github/pockethub/ui/user/OrganizationSelectionListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/user/OrganizationSelectionProvider.java b/app/src/main/java/com/github/pockethub/ui/user/OrganizationSelectionProvider.java similarity index 96% rename from app/src/main/java/com/github/mobile/ui/user/OrganizationSelectionProvider.java rename to app/src/main/java/com/github/pockethub/ui/user/OrganizationSelectionProvider.java index bbe32d674..20c78e821 100644 --- a/app/src/main/java/com/github/mobile/ui/user/OrganizationSelectionProvider.java +++ b/app/src/main/java/com/github/pockethub/ui/user/OrganizationSelectionProvider.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/user/PagedUserFragment.java b/app/src/main/java/com/github/pockethub/ui/user/PagedUserFragment.java similarity index 90% rename from app/src/main/java/com/github/mobile/ui/user/PagedUserFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/PagedUserFragment.java index cfa69b26e..57985be4a 100644 --- a/app/src/main/java/com/github/mobile/ui/user/PagedUserFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/PagedUserFragment.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.view.View; import android.widget.ListView; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.accounts.AccountUtils; -import com.github.mobile.ui.PagedItemFragment; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.accounts.AccountUtils; +import com.github.pockethub.ui.PagedItemFragment; +import com.github.pockethub.util.AvatarLoader; import com.google.inject.Inject; import java.util.List; diff --git a/app/src/main/java/com/github/mobile/ui/user/UriLauncherActivity.java b/app/src/main/java/com/github/pockethub/ui/user/UriLauncherActivity.java similarity index 89% rename from app/src/main/java/com/github/mobile/ui/user/UriLauncherActivity.java rename to app/src/main/java/com/github/pockethub/ui/user/UriLauncherActivity.java index 6e6ac7bdd..3e62cf9ff 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UriLauncherActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UriLauncherActivity.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import static android.content.DialogInterface.BUTTON_POSITIVE; import static android.content.Intent.ACTION_VIEW; @@ -32,18 +32,18 @@ import android.os.Bundle; import android.text.TextUtils; -import com.github.mobile.R; -import com.github.mobile.core.commit.CommitMatch; -import com.github.mobile.core.commit.CommitUriMatcher; -import com.github.mobile.core.gist.GistUriMatcher; -import com.github.mobile.core.issue.IssueUriMatcher; -import com.github.mobile.core.repo.RepositoryUriMatcher; -import com.github.mobile.core.user.UserUriMatcher; -import com.github.mobile.ui.LightAlertDialog; -import com.github.mobile.ui.commit.CommitViewActivity; -import com.github.mobile.ui.gist.GistsViewActivity; -import com.github.mobile.ui.issue.IssuesViewActivity; -import com.github.mobile.ui.repo.RepositoryViewActivity; +import com.github.pockethub.R; +import com.github.pockethub.core.commit.CommitMatch; +import com.github.pockethub.core.commit.CommitUriMatcher; +import com.github.pockethub.core.gist.GistUriMatcher; +import com.github.pockethub.core.issue.IssueUriMatcher; +import com.github.pockethub.core.repo.RepositoryUriMatcher; +import com.github.pockethub.core.user.UserUriMatcher; +import com.github.pockethub.ui.LightAlertDialog; +import com.github.pockethub.ui.commit.CommitViewActivity; +import com.github.pockethub.ui.gist.GistsViewActivity; +import com.github.pockethub.ui.issue.IssuesViewActivity; +import com.github.pockethub.ui.repo.RepositoryViewActivity; import java.net.URI; import java.text.MessageFormat; diff --git a/app/src/main/java/com/github/mobile/ui/user/UserCreatedNewsFragment.java b/app/src/main/java/com/github/pockethub/ui/user/UserCreatedNewsFragment.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/user/UserCreatedNewsFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/UserCreatedNewsFragment.java index 4fe309b96..664433684 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserCreatedNewsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UserCreatedNewsFragment.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.core.ResourcePager; import org.eclipse.egit.github.core.client.PageIterator; import org.eclipse.egit.github.core.event.Event; diff --git a/app/src/main/java/com/github/mobile/ui/user/UserFollowersFragment.java b/app/src/main/java/com/github/pockethub/ui/user/UserFollowersFragment.java similarity index 87% rename from app/src/main/java/com/github/mobile/ui/user/UserFollowersFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/UserFollowersFragment.java index 30da0858f..4424a0c6a 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserFollowersFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UserFollowersFragment.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import static com.github.mobile.Intents.EXTRA_USER; +import static com.github.pockethub.Intents.EXTRA_USER; import android.app.Activity; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.user.UserPager; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.user.UserPager; import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; diff --git a/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java b/app/src/main/java/com/github/pockethub/ui/user/UserFollowingFragment.java similarity index 87% rename from app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/UserFollowingFragment.java index 9df454ad2..0f612e4e0 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserFollowingFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UserFollowingFragment.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import static com.github.mobile.Intents.EXTRA_USER; +import static com.github.pockethub.Intents.EXTRA_USER; import android.app.Activity; -import com.github.mobile.core.ResourcePager; -import com.github.mobile.core.user.UserPager; +import com.github.pockethub.core.ResourcePager; +import com.github.pockethub.core.user.UserPager; import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.PageIterator; diff --git a/app/src/main/java/com/github/mobile/ui/user/UserListAdapter.java b/app/src/main/java/com/github/pockethub/ui/user/UserListAdapter.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/user/UserListAdapter.java rename to app/src/main/java/com/github/pockethub/ui/user/UserListAdapter.java index 8ed970bdd..715fb2f24 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UserListAdapter.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.view.LayoutInflater; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; -import com.github.mobile.R; -import com.github.mobile.util.AvatarLoader; +import com.github.pockethub.R; +import com.github.pockethub.util.AvatarLoader; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java b/app/src/main/java/com/github/pockethub/ui/user/UserNewsFragment.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/UserNewsFragment.java index c5cf8ad44..1a6460ac5 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserNewsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UserNewsFragment.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import static com.github.mobile.Intents.EXTRA_USER; +import static com.github.pockethub.Intents.EXTRA_USER; import android.os.Bundle; -import com.github.mobile.core.user.UserEventMatcher.UserPair; -import com.github.mobile.ui.NewsFragment; +import com.github.pockethub.core.user.UserEventMatcher.UserPair; +import com.github.pockethub.ui.NewsFragment; import org.eclipse.egit.github.core.Repository; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/ui/user/UserPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/user/UserPagerAdapter.java similarity index 91% rename from app/src/main/java/com/github/mobile/ui/user/UserPagerAdapter.java rename to app/src/main/java/com/github/pockethub/ui/user/UserPagerAdapter.java index c7a6a7eeb..6bf8c379f 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UserPagerAdapter.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import android.content.res.Resources; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; -import com.github.mobile.R; -import com.github.mobile.ui.FragmentPagerAdapter; -import com.github.mobile.ui.repo.UserRepositoryListFragment; +import com.github.pockethub.R; +import com.github.pockethub.ui.FragmentPagerAdapter; +import com.github.pockethub.ui.repo.UserRepositoryListFragment; /** * Pager adapter for a user's different views diff --git a/app/src/main/java/com/github/mobile/ui/user/UserReceivedNewsFragment.java b/app/src/main/java/com/github/pockethub/ui/user/UserReceivedNewsFragment.java similarity index 93% rename from app/src/main/java/com/github/mobile/ui/user/UserReceivedNewsFragment.java rename to app/src/main/java/com/github/pockethub/ui/user/UserReceivedNewsFragment.java index f76b2909c..09dee07ce 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserReceivedNewsFragment.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UserReceivedNewsFragment.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import com.github.mobile.core.ResourcePager; +import com.github.pockethub.core.ResourcePager; import org.eclipse.egit.github.core.client.PageIterator; import org.eclipse.egit.github.core.event.Event; diff --git a/app/src/main/java/com/github/mobile/ui/user/UserViewActivity.java b/app/src/main/java/com/github/pockethub/ui/user/UserViewActivity.java similarity index 88% rename from app/src/main/java/com/github/mobile/ui/user/UserViewActivity.java rename to app/src/main/java/com/github/pockethub/ui/user/UserViewActivity.java index 1f68dd5d6..bc8c3d2fa 100644 --- a/app/src/main/java/com/github/mobile/ui/user/UserViewActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/user/UserViewActivity.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; -import static com.github.mobile.Intents.EXTRA_USER; -import static com.github.mobile.util.TypefaceUtils.ICON_FOLLOW; -import static com.github.mobile.util.TypefaceUtils.ICON_NEWS; -import static com.github.mobile.util.TypefaceUtils.ICON_PUBLIC; -import static com.github.mobile.util.TypefaceUtils.ICON_WATCH; +import static com.github.pockethub.Intents.EXTRA_USER; +import static com.github.pockethub.util.TypefaceUtils.ICON_FOLLOW; +import static com.github.pockethub.util.TypefaceUtils.ICON_NEWS; +import static com.github.pockethub.util.TypefaceUtils.ICON_PUBLIC; +import static com.github.pockethub.util.TypefaceUtils.ICON_WATCH; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; @@ -31,16 +31,16 @@ import android.widget.ProgressBar; import com.github.kevinsawicki.wishlist.ViewUtils; -import com.github.mobile.Intents.Builder; -import com.github.mobile.R; -import com.github.mobile.core.user.FollowUserTask; -import com.github.mobile.core.user.FollowingUserTask; -import com.github.mobile.core.user.RefreshUserTask; -import com.github.mobile.core.user.UnfollowUserTask; -import com.github.mobile.ui.MainActivity; -import com.github.mobile.ui.TabPagerActivity; -import com.github.mobile.util.AvatarLoader; -import com.github.mobile.util.ToastUtils; +import com.github.pockethub.Intents.Builder; +import com.github.pockethub.R; +import com.github.pockethub.core.user.FollowUserTask; +import com.github.pockethub.core.user.FollowingUserTask; +import com.github.pockethub.core.user.RefreshUserTask; +import com.github.pockethub.core.user.UnfollowUserTask; +import com.github.pockethub.ui.MainActivity; +import com.github.pockethub.ui.TabPagerActivity; +import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.ToastUtils; import com.google.inject.Inject; import org.eclipse.egit.github.core.User; diff --git a/app/src/main/java/com/github/mobile/util/AvatarLoader.java b/app/src/main/java/com/github/pockethub/util/AvatarLoader.java similarity index 99% rename from app/src/main/java/com/github/mobile/util/AvatarLoader.java rename to app/src/main/java/com/github/pockethub/util/AvatarLoader.java index 4b5a47f02..3ae5439e5 100644 --- a/app/src/main/java/com/github/mobile/util/AvatarLoader.java +++ b/app/src/main/java/com/github/pockethub/util/AvatarLoader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import android.content.Context; import android.content.res.TypedArray; @@ -24,7 +24,7 @@ import android.util.Log; import android.widget.ImageView; -import com.github.mobile.R; +import com.github.pockethub.R; import com.google.inject.Inject; import com.squareup.okhttp.Cache; import com.squareup.okhttp.OkHttpClient; diff --git a/app/src/main/java/com/github/mobile/util/GravatarUtils.java b/app/src/main/java/com/github/pockethub/util/GravatarUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/util/GravatarUtils.java rename to app/src/main/java/com/github/pockethub/util/GravatarUtils.java index 0d3a40667..39bfbc1fa 100644 --- a/app/src/main/java/com/github/mobile/util/GravatarUtils.java +++ b/app/src/main/java/com/github/pockethub/util/GravatarUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import static java.util.Locale.US; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/util/HtmlUtils.java b/app/src/main/java/com/github/pockethub/util/HtmlUtils.java similarity index 99% rename from app/src/main/java/com/github/mobile/util/HtmlUtils.java rename to app/src/main/java/com/github/pockethub/util/HtmlUtils.java index a3d5d009f..4a330ca48 100644 --- a/app/src/main/java/com/github/mobile/util/HtmlUtils.java +++ b/app/src/main/java/com/github/pockethub/util/HtmlUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import android.graphics.Canvas; import android.graphics.Paint; diff --git a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java b/app/src/main/java/com/github/pockethub/util/HttpImageGetter.java similarity index 98% rename from app/src/main/java/com/github/mobile/util/HttpImageGetter.java rename to app/src/main/java/com/github/pockethub/util/HttpImageGetter.java index 3c8acfa56..dd01a2beb 100644 --- a/app/src/main/java/com/github/mobile/util/HttpImageGetter.java +++ b/app/src/main/java/com/github/pockethub/util/HttpImageGetter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import static android.util.Base64.DEFAULT; import static android.view.View.GONE; @@ -33,8 +33,8 @@ import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; -import com.github.mobile.R; -import com.github.mobile.accounts.AuthenticatedUserTask; +import com.github.pockethub.R; +import com.github.pockethub.accounts.AuthenticatedUserTask; import com.google.inject.Inject; import java.io.File; diff --git a/app/src/main/java/com/github/mobile/util/ImageUtils.java b/app/src/main/java/com/github/pockethub/util/ImageUtils.java similarity index 99% rename from app/src/main/java/com/github/mobile/util/ImageUtils.java rename to app/src/main/java/com/github/pockethub/util/ImageUtils.java index b2fbb8b73..6e9ee7406 100644 --- a/app/src/main/java/com/github/mobile/util/ImageUtils.java +++ b/app/src/main/java/com/github/pockethub/util/ImageUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import static android.graphics.Bitmap.Config.ARGB_8888; import static android.graphics.Color.WHITE; diff --git a/app/src/main/java/com/github/mobile/util/MarkdownUtils.java b/app/src/main/java/com/github/pockethub/util/MarkdownUtils.java similarity index 97% rename from app/src/main/java/com/github/mobile/util/MarkdownUtils.java rename to app/src/main/java/com/github/pockethub/util/MarkdownUtils.java index 30c60f3be..311523d5e 100644 --- a/app/src/main/java/com/github/mobile/util/MarkdownUtils.java +++ b/app/src/main/java/com/github/pockethub/util/MarkdownUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import static java.util.Locale.US; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/util/PreferenceUtils.java b/app/src/main/java/com/github/pockethub/util/PreferenceUtils.java similarity index 97% rename from app/src/main/java/com/github/mobile/util/PreferenceUtils.java rename to app/src/main/java/com/github/pockethub/util/PreferenceUtils.java index ed9d29fe7..eb6852a0b 100644 --- a/app/src/main/java/com/github/mobile/util/PreferenceUtils.java +++ b/app/src/main/java/com/github/pockethub/util/PreferenceUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import android.content.Context; import android.content.SharedPreferences; diff --git a/app/src/main/java/com/github/mobile/util/ServiceUtils.java b/app/src/main/java/com/github/pockethub/util/ServiceUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/util/ServiceUtils.java rename to app/src/main/java/com/github/pockethub/util/ServiceUtils.java index 23a609f20..11e1fe20b 100644 --- a/app/src/main/java/com/github/mobile/util/ServiceUtils.java +++ b/app/src/main/java/com/github/pockethub/util/ServiceUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import static android.content.Context.WINDOW_SERVICE; import static android.util.TypedValue.COMPLEX_UNIT_DIP; diff --git a/app/src/main/java/com/github/mobile/util/ShareUtils.java b/app/src/main/java/com/github/pockethub/util/ShareUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/util/ShareUtils.java rename to app/src/main/java/com/github/pockethub/util/ShareUtils.java index 06ae0da0a..0814bb059 100644 --- a/app/src/main/java/com/github/mobile/util/ShareUtils.java +++ b/app/src/main/java/com/github/pockethub/util/ShareUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import static android.content.Intent.ACTION_SEND; import static android.content.Intent.EXTRA_SUBJECT; diff --git a/app/src/main/java/com/github/mobile/util/SourceEditor.java b/app/src/main/java/com/github/pockethub/util/SourceEditor.java similarity index 98% rename from app/src/main/java/com/github/mobile/util/SourceEditor.java rename to app/src/main/java/com/github/pockethub/util/SourceEditor.java index 75659676b..9c4e8c176 100644 --- a/app/src/main/java/com/github/mobile/util/SourceEditor.java +++ b/app/src/main/java/com/github/pockethub/util/SourceEditor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import static org.eclipse.egit.github.core.Blob.ENCODING_BASE64; import static org.eclipse.egit.github.core.client.IGitHubConstants.CHARSET_UTF8; @@ -25,7 +25,7 @@ import android.webkit.WebView; import android.webkit.WebViewClient; -import com.github.mobile.ui.user.UriLauncherActivity; +import com.github.pockethub.ui.user.UriLauncherActivity; import java.io.UnsupportedEncodingException; diff --git a/app/src/main/java/com/github/mobile/util/TimeUtils.java b/app/src/main/java/com/github/pockethub/util/TimeUtils.java similarity index 97% rename from app/src/main/java/com/github/mobile/util/TimeUtils.java rename to app/src/main/java/com/github/pockethub/util/TimeUtils.java index 80ccad384..75146a404 100644 --- a/app/src/main/java/com/github/mobile/util/TimeUtils.java +++ b/app/src/main/java/com/github/pockethub/util/TimeUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import static android.text.format.DateUtils.FORMAT_NUMERIC_DATE; import static android.text.format.DateUtils.FORMAT_SHOW_DATE; diff --git a/app/src/main/java/com/github/mobile/util/ToastUtils.java b/app/src/main/java/com/github/pockethub/util/ToastUtils.java similarity index 98% rename from app/src/main/java/com/github/mobile/util/ToastUtils.java rename to app/src/main/java/com/github/pockethub/util/ToastUtils.java index 3d352dc33..0c486531e 100644 --- a/app/src/main/java/com/github/mobile/util/ToastUtils.java +++ b/app/src/main/java/com/github/pockethub/util/ToastUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import android.app.Activity; import android.text.TextUtils; diff --git a/app/src/main/java/com/github/mobile/util/TypefaceUtils.java b/app/src/main/java/com/github/pockethub/util/TypefaceUtils.java similarity index 99% rename from app/src/main/java/com/github/mobile/util/TypefaceUtils.java rename to app/src/main/java/com/github/pockethub/util/TypefaceUtils.java index 93c088862..72540267f 100644 --- a/app/src/main/java/com/github/mobile/util/TypefaceUtils.java +++ b/app/src/main/java/com/github/pockethub/util/TypefaceUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.github.mobile.util; +package com.github.pockethub.util; import android.content.Context; import android.graphics.Paint; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 99b89635c..98221e327 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -33,7 +33,7 @@ android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" - android:name="com.github.mobile.ui.NavigationDrawerFragment" + android:name="com.github.pockethub.ui.NavigationDrawerFragment" tools:layout="@layout/fragment_navigation_drawer" /> \ No newline at end of file diff --git a/app/src/main/res/layout/commit_compare.xml b/app/src/main/res/layout/commit_compare.xml index dba30bdcb..65b7cdf29 100644 --- a/app/src/main/res/layout/commit_compare.xml +++ b/app/src/main/res/layout/commit_compare.xml @@ -31,6 +31,6 @@ android:layout_below="@id/toolbar" android:layout_width="match_parent" android:layout_height="match_parent" - class="com.github.mobile.ui.commit.CommitCompareListFragment" /> + class="com.github.pockethub.ui.commit.CommitCompareListFragment" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gist_file_view.xml b/app/src/main/res/layout/gist_file_view.xml index ec7a1257d..32a151784 100644 --- a/app/src/main/res/layout/gist_file_view.xml +++ b/app/src/main/res/layout/gist_file_view.xml @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - diff --git a/app/src/main/res/layout/issue_search.xml b/app/src/main/res/layout/issue_search.xml index a2b1d8c58..3b7a12b42 100644 --- a/app/src/main/res/layout/issue_search.xml +++ b/app/src/main/res/layout/issue_search.xml @@ -32,6 +32,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/toolbar" - class="com.github.mobile.ui.issue.SearchIssueListFragment" /> + class="com.github.pockethub.ui.issue.SearchIssueListFragment" /> \ No newline at end of file diff --git a/app/src/main/res/layout/issues_filter_list.xml b/app/src/main/res/layout/issues_filter_list.xml index 0734dbf4d..58fa78b70 100644 --- a/app/src/main/res/layout/issues_filter_list.xml +++ b/app/src/main/res/layout/issues_filter_list.xml @@ -32,6 +32,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/toolbar" - class="com.github.mobile.ui.issue.FilterListFragment" /> + class="com.github.pockethub.ui.issue.FilterListFragment" /> \ No newline at end of file diff --git a/app/src/main/res/layout/navigation_drawer_list_item_image.xml b/app/src/main/res/layout/navigation_drawer_list_item_image.xml index 4ebf4a85a..12c43509e 100644 --- a/app/src/main/res/layout/navigation_drawer_list_item_image.xml +++ b/app/src/main/res/layout/navigation_drawer_list_item_image.xml @@ -1,5 +1,5 @@ - @@ -24,4 +24,4 @@ android:textColor="#212121" android:layout_centerVertical="true" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/navigation_drawer_list_item_text.xml b/app/src/main/res/layout/navigation_drawer_list_item_text.xml index 55be74ecc..57ebc55bb 100644 --- a/app/src/main/res/layout/navigation_drawer_list_item_text.xml +++ b/app/src/main/res/layout/navigation_drawer_list_item_text.xml @@ -1,5 +1,5 @@ - @@ -26,4 +26,4 @@ android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:layout_centerVertical="true" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/pager.xml b/app/src/main/res/layout/pager.xml index 30942aed7..0d6fa2772 100644 --- a/app/src/main/res/layout/pager.xml +++ b/app/src/main/res/layout/pager.xml @@ -27,7 +27,7 @@ android:background="?attr/colorPrimary" android:id="@+id/toolbar" /> - diff --git a/app/src/main/res/layout/pager_with_tabs.xml b/app/src/main/res/layout/pager_with_tabs.xml index 90f1e9f3a..bd2099489 100644 --- a/app/src/main/res/layout/pager_with_tabs.xml +++ b/app/src/main/res/layout/pager_with_tabs.xml @@ -47,7 +47,7 @@ - - diff --git a/app/src/main/res/layout/repo_contributors.xml b/app/src/main/res/layout/repo_contributors.xml index 9381f2412..5e816bbb6 100644 --- a/app/src/main/res/layout/repo_contributors.xml +++ b/app/src/main/res/layout/repo_contributors.xml @@ -33,6 +33,6 @@ android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_below="@id/toolbar" - class="com.github.mobile.ui.repo.RepositoryContributorsFragment" /> + class="com.github.pockethub.ui.repo.RepositoryContributorsFragment" /> \ No newline at end of file diff --git a/app/src/main/res/layout/repo_issue_list.xml b/app/src/main/res/layout/repo_issue_list.xml index d9e1fb7d1..04a2c4eb1 100644 --- a/app/src/main/res/layout/repo_issue_list.xml +++ b/app/src/main/res/layout/repo_issue_list.xml @@ -33,6 +33,6 @@ android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_below="@id/toolbar" - class="com.github.mobile.ui.issue.IssuesFragment" /> + class="com.github.pockethub.ui.issue.IssuesFragment" /> \ No newline at end of file diff --git a/app/src/test/java/com/github/mobile/ui/user/IconAndViewTextManagerTest.java b/app/src/test/java/com/github/pockethub/ui/user/IconAndViewTextManagerTest.java similarity index 99% rename from app/src/test/java/com/github/mobile/ui/user/IconAndViewTextManagerTest.java rename to app/src/test/java/com/github/pockethub/ui/user/IconAndViewTextManagerTest.java index 7cb98b938..a22e3f769 100644 --- a/app/src/test/java/com/github/mobile/ui/user/IconAndViewTextManagerTest.java +++ b/app/src/test/java/com/github/pockethub/ui/user/IconAndViewTextManagerTest.java @@ -1,6 +1,6 @@ -package com.github.mobile.ui.user; +package com.github.pockethub.ui.user; -import com.github.mobile.util.TypefaceUtils; +import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.event.Event; import org.eclipse.egit.github.core.event.IssuesPayload; From 23b1defc9e7348a765fe0b89b12a60ebe07b5093 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Wed, 5 Aug 2015 00:38:54 -0700 Subject: [PATCH 0556/1055] Reset the build number and version names --- app/build.gradle | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c457e0a89..712330b81 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,23 @@ apply plugin: 'com.android.application' +repositories { + flatDir { + dirs 'libs' + } +} + +// Manifest version information! +def versionMajor = 0 +def versionMinor = 1 +def versionPatch = 0 +def versionBuild = 0 // bump for dogfood builds, public betas, etc. + +def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() +def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")) + +def isTravis = "true".equals(System.getenv("TRAVIS")) +def preDexEnabled = "true".equals(System.getProperty("pre-dex", "true")) + android { compileSdkVersion 22 buildToolsVersion '22.0.1' @@ -8,13 +26,13 @@ android { applicationId 'com.github.pockethub' minSdkVersion 15 targetSdkVersion 22 - versionCode 1900 - versionName '1.9.0' + versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild + versionName "${versionMajor}.${versionMinor}.${versionPatch}" def Properties githubProps = new Properties() - if(file('../github.properties').exists()) + if (file('../github.properties').exists()) { githubProps.load(new FileInputStream(file('../github.properties'))) - else + } else { logger.log(LogLevel.ERROR, "github.properties can not be found, please add it to the project root") resValue "string", "github_secret", getValue(githubProps, "GITHUB_SECRET") @@ -23,6 +41,10 @@ android { def oauth = getValue(githubProps, "GITHUB_CALLBACK") resValue "string", "github_oauth", oauth resValue "string", "github_oauth_scheme", oauth != "DEFAULT" ? oauth.split("://")[0] : "DEFAULT" + } + + buildConfigField "String", "GIT_SHA", "\"${gitSha}\"" + buildConfigField "String", "BUILD_TIME", "\"${buildTime}\"" } packagingOptions { @@ -35,11 +57,13 @@ android { warning 'MissingTranslation' abortOnError false } -} -repositories { - flatDir { - dirs 'libs' + dexOptions { + // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false. +// preDexLibraries = preDexEnabled && !isTravis + + // False for now until we set up Travis CI for this + preDexLibraries = false } } From a50512ba621dc0870789d6f35a514ec3653d8094 Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Wed, 5 Aug 2015 00:40:57 -0700 Subject: [PATCH 0557/1055] Add some type safety and standard braces --- app/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 712330b81..a35683216 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -38,7 +38,7 @@ android { resValue "string", "github_secret", getValue(githubProps, "GITHUB_SECRET") resValue "string", "github_client", getValue(githubProps, "GITHUB_CLIENT") - def oauth = getValue(githubProps, "GITHUB_CALLBACK") + String oauth = getValue(githubProps, "GITHUB_CALLBACK") resValue "string", "github_oauth", oauth resValue "string", "github_oauth_scheme", oauth != "DEFAULT" ? oauth.split("://")[0] : "DEFAULT" } @@ -67,12 +67,12 @@ android { } } -def getValue(def props, def name){ - if(props && props[name]) +def String getValue(Properties props, String name) { + if (props && props[name]) { return props[name] - else if(System.getenv(name)) + } else if (System.getenv(name)) { return System.getenv(name) - else { + } else { logger.log(LogLevel.ERROR, name + " has not been provided, add it to your github.properties file") return "DEFAULT" } From d07e20f26fad4e2f8240301e437e14a2e903950c Mon Sep 17 00:00:00 2001 From: Karl Lindmark Date: Wed, 5 Aug 2015 01:24:40 +0200 Subject: [PATCH 0558/1055] Update the Swedish translation Update the Swedish translation with translations for the new English strings, as well as using more suitable words. --- app/src/main/res/values-sv/strings.xml | 194 ++++++++++++++----------- app/src/main/res/values/config.xml | 2 +- 2 files changed, 108 insertions(+), 88 deletions(-) diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 252c994c6..7a3db93df 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -18,9 +18,9 @@ Inläsning av konto & organisationer misslyckades - Inläsning av frågor misslyckades - Inläsning av repositories misslyckades - Inläsning av repository misslyckades + Inläsning av ärenden misslyckades + Inläsning av repon misslyckades + Inläsning av repot misslyckades Inläsning av medverkande misslyckades Inläsning av Gist misslyckades Inläsning av nyheter misslyckades @@ -29,7 +29,7 @@ Inläsning av personen misslyckades Inläsning av Gistfilens innehåll misslyckades Inläsning av Gists misslyckades - Inläsning av frågan misslyckades + Inläsning av ärendet misslyckades Inläsning av medarbetare misslyckades Inläsningen av milstolpar misslyckades Inläsning av etiketter misslyckades @@ -45,6 +45,8 @@ Misslyckades att avläsa följar-status Stjärnmärkning misslyckades Borttagning av stjärnmärkning misslyckades + Forkningen misslyckades + Borttagningen misslyckades Misslyckades att avläsa stjärnmärkning Misslyckades med att rendera markdown Misslyckades med sökning efter användare @@ -52,29 +54,29 @@ - Laddar Gist… - Laddar slumpvald Gist… - Laddar flera frågor… - Laddar frågor… - Laddar kommentarer… - Laddar repository… - Laddar frågan… - Laddar nyheter… - Laddar prenumeranter… - Laddar personer… - Laddar Gists… - Laddar medarbetare… - Laddar milstolpar… - Laddar etiketter… - Laddar commits… - Läser in filer & commits… - Läser in brancher & taggar… + Laddar Gist… + Laddar slumpvald Gist… + Laddar fler ärenden… + Laddar ärenden… + Laddar kommentarer… + Laddar repot… + Laddar ärendet… + Laddar nyheter… + Laddar prenumeranter… + Laddar personer… + Laddar Gists… + Laddar medarbetare… + Laddar milstolpar… + Laddar etiketter… + Laddar commits… + Läser in filer & commits… + Läser in brancher & taggar… Inga bokmärken - Inga repositories + Inga repon Inga medverkande Inga frågor Inga Gists @@ -87,29 +89,31 @@ - Uppdaterar förvärvare… - Uppdaterar frågor… - Uppdaterar etiketter… - Uppdaterar milstolpar… + Uppdaterar förvärvare… + Uppdaterar ärenden… + Uppdaterar etiketter… + Uppdaterar milstolpar… + Hem Nyheter - Frågor + Ärenden Gists Commits GitHub sök - Hitta Repositories - Hitta Frågor - Sök… + Hitta repon + Hitta ärenden + Sök… Pull Request # - Rensa Historik - Search history cleared - Loggar in… - Skapar Gist… + Rensa sökhistorik + Sökhistorik rensad + Loggar in… + Laddar användarprofil… + Skapar Gist… Skapa Skapa Gist puts \'Hello World!\' - Gör den här Gisten allmän + Gör den här Gisten publik Medverkande fil.rb Gist @@ -126,49 +130,54 @@ Ta bort TA BORT Uppdatera - Frågor + Ärenden Bokmärken Gists - Fråga # + Ärende # Gist\u0020 - Filtrera Frågor - Skapa Kommentar + Filtrera ärenden + Skapa kommentar Skriv en kommentar - Visa Mer… - Repositories - Frågor - Ändra Etiketter + Visa mer… + Repon + Ärenden + Ändra etiketter Milstolpe: - Ändra Milstolpe + Ändra milstolpe Ändra Förvärvaren Beskrivning Gist skapad i Android Titel Ändra Stjärnmärk - Stärnmärker Gist… + Stärnmärker Gist… Ta bort stjärmärkning - Tar bort stjärmärkning av Gist… + Forka + Tar bort stjärmärkning av Gist… Konton - Välj Förvärvare - Välj Milstolpe - Välj Etiketter - Välj Branch eller Tag + Välj förvärvare + Välj milstolpe + Välj etiketter + Välj branch eller tag Autentiseringskod Tvåfaktor-autentisering är aktiverad för ditt konto. Ange autentiseringskod för att verifiera din identitet. - Inga Milstolpar + Inga milstolpar Ingen har tilldelats detta är tilldelad Inga Gists hittades - Bekräfta Borttagning + Bekräfta borttagning Är du säker på att du vill ta bort den här Gisten? - Tar bort Gist… - Skapar kommentar… + Tar bort Gist… + Är du säker på att du vill radera denna kommentar? + Radera kommentar + Skapar kommentar… + Uppdaterar kommentar… + Raderar kommentar… Är du säker på att du vill ta bort det här bokmärket? - Fråga - Ny Fråga + Ärendeöversikt + Nytt ärende Anonym - Frågefilter sparat till bokmärken + Ärendefilter sparat till bokmärken NYLIGEN VISADE Senaste Ta bort senaste @@ -185,42 +194,42 @@ Ny på GitHub? <a href=\"https://github.com/join\">Klicka här</a> för att registrera dig Osäker på vad du ska göra? <a href=\"https://help.github.com/articles/about-two-factor-authentication\">Få hjälp.</a> Kan inte ansluta till GitHub - Ange ett giltligt Användarnamn & lösenord - Ange ett giltligt lösenord. + Ange ett giltigt användarnamn & lösenord + Ange ett giltigt lösenord. Lösenord - Användarnamn eller Email - Användarnamn eller Email + Användarnamn eller epost + Användarnamn eller epost Prenumeranter Prenumererar på Följ - Sluta följa + Avfölja Prenumeranter Prenumererar Medlemmar - Stänger Fråga… - Öppnar Frågan Igen… + Stänger ärende… + Öppnar Frågan Igen… Avatar - Skapar Fråga… + Skapar ärende… skapad\u0020 updaterad\u0020 öppnad\u0020 Rensa Commits: %d - Öppna Frågor - Stängda Frågor - Ta Bort Bokmärke + Öppna ärenden + Stängda ärenden + Radera bokmärke Spara Tillämpa Etiketter: Förvärvare Milstolpe Etiketter - Är du säker på att du vill stänga den här frågan? - Är du säker på att du vill öppna den här frågan igen? - Stäng Fråga - Öppna Fråga Igen + Är du säker på att du vill stänga det här ärendet? + Är du säker på att du vill öppna det här ärendet igen? + Stäng ärende + Öppna ärende igen Stängd - Ingen Beskrivning Given. + Ingen beskrivning given. Stäng Öppna Igen Ogiltlig GitHub-adress @@ -228,9 +237,9 @@ Avbryt OSÄKER App-konflikt - En annan installerad App är redan konfigurerad för GitHub autentisering. \n\nDu måste ta bort den andra appen från konto och synk inställningarna och avinstallera den innan GitHub appen kan användas. - Öppnar {0}… - Jämför Commit + En annan installerad app är redan konfigurerad för GitHub-autentisering. \n\nDu måste ta bort den andra appen från konto- och synkinställningarna och avinstallera den innan GitHub-appen kan användas. + Öppnar {0}… + Jämför commit Commit\u0020 Förälder\u0020 skrev detta den @@ -242,17 +251,18 @@ Aktivera wrapping Inaktivera wrapping Kod - Följer personer… - Slutar följa personer… - Stjärnmärk… - Ta bort stjärnmärkning… - Raderar repository… - Navigera till… + Följer personer… + Avföljer personer… + Stjärnmärk… + Ta bort stjärnmärkning… + Forkar repot… + Raderar repot… + Navigera till… Navigera till %s %d commits - repositories + repon användare nyheter följer @@ -262,13 +272,13 @@ medlemmar kod commits - problem + ärenden visat tilldelat skapat nämnt mina - sjtärnmärkt + stjärnmärkt alla Dela @@ -280,12 +290,22 @@ Kopiera hash Kopierad till clipboard + + Stäng navigationsvyn + Öppna navigationsvyn + Underrubrik + Är du helt säker? Du kan INTE ångra detta. - Detta kommer att radera repository, wiki, frågor, kommentarer och + Detta kommer att radera repot, wiki, frågor, kommentarer och alla medverkarkopplingar permanent. - Repository har raderats + Repot har raderats + Autentisering görs nu via hemsidan, + tryck nu på knappen för att fortsätta. + \n\n I och med att Github har infört restriktioner mot tredjepartsapplikationer är det + inte längre möjligt att verkställa ändringar mot vissa organisationer. Du kan läsa mer här: \n + https://help.github.com/articles/about-third-party-application-restrictions/ diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml index 9254e5569..1031441de 100644 --- a/app/src/main/res/values/config.xml +++ b/app/src/main/res/values/config.xml @@ -1,4 +1,4 @@ - com.github + com.github \ No newline at end of file From 55e162252ab4525c6ba3cd97746e78cd647442f4 Mon Sep 17 00:00:00 2001 From: Karl Lindmark Date: Wed, 5 Aug 2015 01:36:16 +0200 Subject: [PATCH 0559/1055] Update the Swedish translation further --- app/src/main/res/values-sv/strings.xml | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 7a3db93df..eb4910e5a 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -22,13 +22,13 @@ Inläsning av repon misslyckades Inläsning av repot misslyckades Inläsning av medverkande misslyckades - Inläsning av Gist misslyckades + Inläsning av gist misslyckades Inläsning av nyheter misslyckades Inläsning av prenumeranter misslyckades Inläsning av personer misslyckades Inläsning av personen misslyckades - Inläsning av Gistfilens innehåll misslyckades - Inläsning av Gists misslyckades + Inläsning av gistfilens innehåll misslyckades + Inläsning av gists misslyckades Inläsning av ärendet misslyckades Inläsning av medarbetare misslyckades Inläsningen av milstolpar misslyckades @@ -36,12 +36,12 @@ Inläsning av bokmärken misslyckades Inläsning av medlemmar misslyckades Inläsning av commits misslyckades - Inläsning av commit misslyckades + Inläsning av commiten misslyckades Inläsning av filen misslyckades Inläsning av kod misslyckades Inläsning av brancher & taggar misslyckades Misslyckades att följa personen - Misslyckades att sluta följa personen + Misslyckades att avfölja personen Misslyckades att avläsa följar-status Stjärnmärkning misslyckades Borttagning av stjärnmärkning misslyckades @@ -54,8 +54,8 @@ - Laddar Gist… - Laddar slumpvald Gist… + Laddar gist… + Laddar slumpvald gist… Laddar fler ärenden… Laddar ärenden… Laddar kommentarer… @@ -64,7 +64,7 @@ Laddar nyheter… Laddar prenumeranter… Laddar personer… - Laddar Gists… + Laddar gists… Laddar medarbetare… Laddar milstolpar… Laddar etiketter… @@ -78,8 +78,8 @@ Inga bokmärken Inga repon Inga medverkande - Inga frågor - Inga Gists + Inga ärenden + Inga gists Inga personer Inga prenumeranter Inga medlemmar @@ -104,16 +104,16 @@ Hitta repon Hitta ärenden Sök… - Pull Request # + Pull request # Rensa sökhistorik Sökhistorik rensad Loggar in… Laddar användarprofil… - Skapar Gist… + Skapar gist… Skapa - Skapa Gist + Skapa gist puts \'Hello World!\' - Gör den här Gisten publik + Gör den här gisten publik Medverkande fil.rb Gist @@ -123,7 +123,7 @@ Slumpad Filnamn Filinnehållet - Ny Gist + Ny gist Filtrera Bokmärka Kommentera @@ -150,10 +150,10 @@ Titel Ändra Stjärnmärk - Stärnmärker Gist… + Stärnmärker gist… Ta bort stjärmärkning Forka - Tar bort stjärmärkning av Gist… + Tar bort stjärmärkning av gist… Konton Välj förvärvare Välj milstolpe @@ -164,10 +164,10 @@ Inga milstolpar Ingen har tilldelats detta är tilldelad - Inga Gists hittades + Inga gists hittades Bekräfta borttagning - Är du säker på att du vill ta bort den här Gisten? - Tar bort Gist… + Är du säker på att du vill ta bort den här gisten? + Tar bort gist… Är du säker på att du vill radera denna kommentar? Radera kommentar Skapar kommentar… @@ -207,7 +207,7 @@ Prenumererar Medlemmar Stänger ärende… - Öppnar Frågan Igen… + Öppnar ärendet igen… Avatar Skapar ärende… skapad\u0020 @@ -233,7 +233,7 @@ Stäng Öppna Igen Ogiltlig GitHub-adress - Den följande adressen kunde inte öppnas av den här aplikationen:\n{0} + Den följande adressen kunde inte öppnas av den här applikationen:\n{0} Avbryt OSÄKER App-konflikt @@ -298,7 +298,7 @@ Är du helt säker? Du kan INTE ångra detta. - Detta kommer att radera repot, wiki, frågor, kommentarer och + Detta kommer att radera repot, wiki, ärenden, kommentarer och alla medverkarkopplingar permanent. Repot har raderats From 31c41d448cd12bb7065234d3a3070c5a92ef8d1c Mon Sep 17 00:00:00 2001 From: Karl Lindmark Date: Wed, 5 Aug 2015 10:45:34 +0200 Subject: [PATCH 0560/1055] Update the Swedish translation per the PR comments --- app/src/main/res/values-sv/strings.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index eb4910e5a..aa11a32ec 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -89,7 +89,7 @@ - Uppdaterar förvärvare… + Uppdaterar ansvarig… Uppdaterar ärenden… Uppdaterar etiketter… Uppdaterar milstolpar… @@ -144,18 +144,18 @@ Ändra etiketter Milstolpe: Ändra milstolpe - Ändra Förvärvaren + Ändra ansvarig Beskrivning Gist skapad i Android Titel Ändra Stjärnmärk - Stärnmärker gist… + Stjärnmärker gist… Ta bort stjärmärkning Forka Tar bort stjärmärkning av gist… Konton - Välj förvärvare + Välj ansvarig Välj milstolpe Välj etiketter Välj branch eller tag @@ -202,7 +202,7 @@ Prenumeranter Prenumererar på Följ - Avfölja + Avfölj Prenumeranter Prenumererar Medlemmar @@ -221,7 +221,7 @@ Spara Tillämpa Etiketter: - Förvärvare + Ansvarig Milstolpe Etiketter Är du säker på att du vill stänga det här ärendet? @@ -251,10 +251,10 @@ Aktivera wrapping Inaktivera wrapping Kod - Följer personer… - Avföljer personer… - Stjärnmärk… - Ta bort stjärnmärkning… + Följer användare… + Avföljer användare… + Stjärnmärker… + Tar bort stjärnmärkning… Forkar repot… Raderar repot… Navigera till… From b619377016661b62dc99384a3220a5bdd50515bc Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Wed, 5 Aug 2015 01:15:17 +0200 Subject: [PATCH 0561/1055] =?UTF-8?q?Replace=20"..."=20with=20ellipsis=20c?= =?UTF-8?q?haracter=20(=E2=80=A6,=20…)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values-pt/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 8b1b2e450..a8b339c18 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -276,9 +276,9 @@ Apagar Comentário Copiar hash Repositório excluído - Apagando comentário... - Excluindo... - Editando comentário... + Apagando comentário… + Excluindo… + Editando comentário… Carregamento dos contribuidores falhou Exclusão falhou Pesquisa GitHub From 5abfa7299a8c203d9721b86c0f30cb60f083bc6d Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Wed, 5 Aug 2015 00:33:22 +0200 Subject: [PATCH 0562/1055] updated german translation --- app/src/main/res/values-de/strings.xml | 7 +++++++ app/src/main/res/values/config.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 148db749b..130c0a67f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -302,5 +302,12 @@ Repository ist gelöscht Benutzername oder E-Mail-Adresse + Lade Benutzerprofil... + Die Authentifizierung wird nun über die Website durchgeführt, + drücke den Einloggen-Button um fortzufahren. + \n\n Da GitHub Restriktionen für Drittanbieter hinzugefügt hat, + ist es uns nicht möglich in bestimmten Organisationen zu schreiben. + Mehr Informationen darüber hier:\n + https://help.github.com/articles/about-third-party-application-restrictions/ diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml index 9254e5569..1031441de 100644 --- a/app/src/main/res/values/config.xml +++ b/app/src/main/res/values/config.xml @@ -1,4 +1,4 @@ - com.github + com.github \ No newline at end of file From a84568a08676fd328827030ec319dbb866b14702 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 6 Aug 2015 17:20:52 +0800 Subject: [PATCH 0563/1055] Fix GitHubModule path in roboguice.xml --- app/src/main/res/values/roboguice.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/roboguice.xml b/app/src/main/res/values/roboguice.xml index 97c74b989..7269d69cc 100644 --- a/app/src/main/res/values/roboguice.xml +++ b/app/src/main/res/values/roboguice.xml @@ -16,6 +16,6 @@ --> - com.github.mobile.GitHubModule + com.github.pockethub.GitHubModule From 9d69a53f35a4be6f5fee1d0da1c154bb4289deaf Mon Sep 17 00:00:00 2001 From: Henri Sweers Date: Fri, 7 Aug 2015 04:44:37 -0700 Subject: [PATCH 0564/1055] Update other stale references --- app/src/main/AndroidManifest.xml | 40 +++++++++---------- .../java/com/github/pockethub/Intents.java | 11 ++--- .../pockethub/accounts/AccountUtils.java | 17 ++++---- app/src/main/res/layout/pager_with_tabs.xml | 4 +- proguard.cfg | 8 ++-- 5 files changed, 41 insertions(+), 39 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 74902a676..0babd081e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -57,7 +57,7 @@ android:configChanges="orientation|keyboardHidden|screenSize" android:hardwareAccelerated="true"> - + @@ -70,7 +70,7 @@ android:name="com.github.pockethub.ui.issue.EditIssuesFilterActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -79,7 +79,7 @@ android:name="com.github.pockethub.ui.issue.EditIssueActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -103,7 +103,7 @@ android:configChanges="orientation|keyboardHidden|screenSize" android:hardwareAccelerated="true"> - + @@ -112,7 +112,7 @@ android:name="com.github.pockethub.ui.gist.GistsViewActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -121,7 +121,7 @@ android:name="com.github.pockethub.ui.gist.GistFilesViewActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -130,7 +130,7 @@ android:name="com.github.pockethub.ui.issue.CreateCommentActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -139,7 +139,7 @@ android:name="com.github.pockethub.ui.issue.EditCommentActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -148,7 +148,7 @@ android:name="com.github.pockethub.ui.gist.CreateCommentActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -157,7 +157,7 @@ android:name="com.github.pockethub.ui.gist.EditCommentActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -166,7 +166,7 @@ android:name="com.github.pockethub.ui.commit.CreateCommentActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -176,7 +176,7 @@ android:configChanges="orientation|keyboardHidden|screenSize" android:hardwareAccelerated="true"> - + @@ -190,7 +190,7 @@ android:configChanges="orientation|keyboardHidden|screenSize" android:hardwareAccelerated="true"> - + @@ -200,7 +200,7 @@ android:configChanges="orientation|keyboardHidden|screenSize" android:hardwareAccelerated="true"> - + @@ -209,7 +209,7 @@ android:name="com.github.pockethub.ui.issue.IssuesViewActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -313,7 +313,7 @@ android:configChanges="orientation|keyboardHidden|screenSize" android:label="@string/commit_compare_title"> - + @@ -322,7 +322,7 @@ android:name="com.github.pockethub.ui.commit.CommitViewActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -331,7 +331,7 @@ android:name="com.github.pockethub.ui.commit.CommitFileViewActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -340,7 +340,7 @@ android:name="com.github.pockethub.ui.ref.BranchFileViewActivity" android:configChanges="orientation|keyboardHidden|screenSize"> - + @@ -389,4 +389,4 @@ android:value="@string/github_oauth"/> - \ No newline at end of file + diff --git a/app/src/main/java/com/github/pockethub/Intents.java b/app/src/main/java/com/github/pockethub/Intents.java index 86ffd46c1..3ace3f1ab 100644 --- a/app/src/main/java/com/github/pockethub/Intents.java +++ b/app/src/main/java/com/github/pockethub/Intents.java @@ -15,12 +15,8 @@ */ package com.github.pockethub; -import static org.eclipse.egit.github.core.RepositoryId.createFromUrl; import android.content.Intent; -import java.io.Serializable; -import java.util.ArrayList; - import org.eclipse.egit.github.core.Gist; import org.eclipse.egit.github.core.GistFile; import org.eclipse.egit.github.core.Issue; @@ -28,6 +24,11 @@ import org.eclipse.egit.github.core.RepositoryId; import org.eclipse.egit.github.core.User; +import java.io.Serializable; +import java.util.ArrayList; + +import static org.eclipse.egit.github.core.RepositoryId.createFromUrl; + /** * Helper for creating intents */ @@ -36,7 +37,7 @@ public class Intents { /** * Prefix for all intents created */ - public static final String INTENT_PREFIX = "com.github.mobile."; + public static final String INTENT_PREFIX = "com.github.pockethub."; /** * Prefix for all extra data added to intents diff --git a/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java b/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java index c67b2e11e..5c8b2f474 100644 --- a/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java +++ b/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java @@ -15,11 +15,6 @@ */ package com.github.pockethub.accounts; -import static android.accounts.AccountManager.KEY_ACCOUNT_NAME; -import static android.content.DialogInterface.BUTTON_POSITIVE; -import static android.util.Log.DEBUG; -import static com.github.pockethub.accounts.AccountConstants.ACCOUNT_TYPE; -import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountManagerFuture; @@ -40,13 +35,19 @@ import com.github.pockethub.R; import com.github.pockethub.ui.LightAlertDialog; +import org.eclipse.egit.github.core.User; +import org.eclipse.egit.github.core.client.RequestException; + import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import org.eclipse.egit.github.core.User; -import org.eclipse.egit.github.core.client.RequestException; +import static android.accounts.AccountManager.KEY_ACCOUNT_NAME; +import static android.content.DialogInterface.BUTTON_POSITIVE; +import static android.util.Log.DEBUG; +import static com.github.pockethub.accounts.AccountConstants.ACCOUNT_TYPE; +import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; /** * Helpers for accessing {@link AccountManager} @@ -81,7 +82,7 @@ public static boolean hasAuthenticator(final AccountManager manager) { for (AuthenticatorDescription descriptor : types) if (descriptor != null && ACCOUNT_TYPE.equals(descriptor.type)) { - HAS_AUTHENTICATOR = "com.github.mobile" + HAS_AUTHENTICATOR = "com.github.pockethub" .equals(descriptor.packageName); break; } diff --git a/app/src/main/res/layout/pager_with_tabs.xml b/app/src/main/res/layout/pager_with_tabs.xml index bd2099489..eac8a0ba1 100644 --- a/app/src/main/res/layout/pager_with_tabs.xml +++ b/app/src/main/res/layout/pager_with_tabs.xml @@ -49,7 +49,7 @@ @@ -64,4 +64,4 @@ style="@style/ListSpinner" android:layout_centerInParent="true" android:visibility="gone" /> - \ No newline at end of file + diff --git a/proguard.cfg b/proguard.cfg index 87f745925..571b45b10 100644 --- a/proguard.cfg +++ b/proguard.cfg @@ -46,11 +46,11 @@ *** startFinalizer(java.lang.Class,java.lang.Object); } --keep class com.github.mobile.** --keepclassmembers class com.github.mobile.** { *; } --keepclassmembers class com.github.mobile.** { public (...); } +-keep class com.github.pockethub.** +-keepclassmembers class com.github.pockethub.** { *; } +-keepclassmembers class com.github.pockethub.** { public (...); } -keep class org.eclipse.egit.github.** --keepclassmembers class com.github.mobile.** { public (...); } +-keepclassmembers class com.github.pockethub.** { public (...); } -keepclassmembers class org.eclipse.egit.github.** { *; } -keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock { public (...); } From 3c600da9f654c94f980663dcf8eea8d5a89edc36 Mon Sep 17 00:00:00 2001 From: Henrik Olsson Date: Tue, 11 Aug 2015 13:04:44 +0200 Subject: [PATCH 0565/1055] Fixed build.gradle if statment wrapper --- app/build.gradle | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a35683216..fc3a1848a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -34,14 +34,14 @@ android { githubProps.load(new FileInputStream(file('../github.properties'))) } else { logger.log(LogLevel.ERROR, "github.properties can not be found, please add it to the project root") - - resValue "string", "github_secret", getValue(githubProps, "GITHUB_SECRET") - resValue "string", "github_client", getValue(githubProps, "GITHUB_CLIENT") - - String oauth = getValue(githubProps, "GITHUB_CALLBACK") - resValue "string", "github_oauth", oauth - resValue "string", "github_oauth_scheme", oauth != "DEFAULT" ? oauth.split("://")[0] : "DEFAULT" } + + resValue "string", "github_secret", getValue(githubProps, "GITHUB_SECRET") + resValue "string", "github_client", getValue(githubProps, "GITHUB_CLIENT") + + String oauth = getValue(githubProps, "GITHUB_CALLBACK") + resValue "string", "github_oauth", oauth + resValue "string", "github_oauth_scheme", oauth != "DEFAULT" ? oauth.split("://")[0] : "DEFAULT" buildConfigField "String", "GIT_SHA", "\"${gitSha}\"" buildConfigField "String", "BUILD_TIME", "\"${buildTime}\"" @@ -107,4 +107,4 @@ dependencies { } compile 'com.android.support:design:22.2.1' -} \ No newline at end of file +} From f825fbd722805787adee60cf78c5f33c6d7faf98 Mon Sep 17 00:00:00 2001 From: Henrik Date: Wed, 12 Aug 2015 16:00:14 +0200 Subject: [PATCH 0566/1055] Moved handler creation (Not needed when doing Synchronous calls) --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index e7b4def49..3dd3c6ead 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app' +include ':app', ':GithubAndroidSdk' From 132fbd557cda121dec006f4d4b6b2cfcc82474db Mon Sep 17 00:00:00 2001 From: Henrik Date: Sun, 16 Aug 2015 12:30:02 +0200 Subject: [PATCH 0567/1055] Fixed premature onActivityResult below Lollipop --- app/src/main/AndroidManifest.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0babd081e..96c0a27ef 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -231,7 +231,7 @@ + android:launchMode="singleTop"> @@ -346,7 +346,8 @@ - + Date: Sat, 22 Aug 2015 10:05:15 +0700 Subject: [PATCH 0568/1055] Add progress dialog during webpage loading After "log in" is pressed, there's a blank white screen for several seconds. This will be an indicator that something is happening (which is loading the webpage). It's better than leaving the user wondering. --- .../pockethub/accounts/LoginWebViewActivity.java | 15 +++++++++++++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 16 insertions(+) diff --git a/app/src/main/java/com/github/pockethub/accounts/LoginWebViewActivity.java b/app/src/main/java/com/github/pockethub/accounts/LoginWebViewActivity.java index a4c446e12..bc5e116bd 100644 --- a/app/src/main/java/com/github/pockethub/accounts/LoginWebViewActivity.java +++ b/app/src/main/java/com/github/pockethub/accounts/LoginWebViewActivity.java @@ -1,12 +1,14 @@ package com.github.pockethub.accounts; import android.content.Intent; +import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.webkit.WebViewClient; import com.github.pockethub.R; +import com.github.pockethub.ui.LightProgressDialog; import com.github.pockethub.ui.WebView; public class LoginWebViewActivity extends AppCompatActivity { @@ -17,6 +19,19 @@ protected void onCreate(Bundle savedInstanceState) { WebView webView = new WebView(this); webView.loadUrl(getIntent().getStringExtra(LoginActivity.INTENT_EXTRA_URL)); webView.setWebViewClient(new WebViewClient() { + LightProgressDialog dialog = (LightProgressDialog) LightProgressDialog.create( + LoginWebViewActivity.this, R.string.loading); + + @Override + public void onPageStarted(android.webkit.WebView view, String url, Bitmap favicon) { + dialog.show(); + } + + @Override + public void onPageFinished(android.webkit.WebView view, String url) { + dialog.dismiss(); + } + @Override public boolean shouldOverrideUrlLoading(android.webkit.WebView view, String url) { Uri uri = Uri.parse(url); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 204b0798b..0eed7b042 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -70,6 +70,7 @@ Loading Commits… Loading Files & Comments… Loading Branches & Tags… + Loading… From 2b86ea04d9ef017677c73221f10594f5f47783f6 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Thu, 27 Aug 2015 16:10:19 +0700 Subject: [PATCH 0569/1055] Fix #871. Remove appbar middle line for pre-L --- app/src/main/res/layout/pager_with_tabs.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/src/main/res/layout/pager_with_tabs.xml b/app/src/main/res/layout/pager_with_tabs.xml index eac8a0ba1..c1e7e669a 100644 --- a/app/src/main/res/layout/pager_with_tabs.xml +++ b/app/src/main/res/layout/pager_with_tabs.xml @@ -53,12 +53,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - - Date: Thu, 3 Sep 2015 05:54:41 +0700 Subject: [PATCH 0570/1055] Add Bugsnag --- app/build.gradle | 2 ++ app/src/main/AndroidManifest.xml | 5 +++++ .../main/java/com/github/pockethub/ui/MainActivity.java | 7 +++++-- app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fc3a1848a..3aff5401b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -97,6 +97,8 @@ dependencies { compile 'com.squareup.okio:okio:1.1.0' compile 'com.squareup.retrofit:retrofit:1.9.0' compile 'com.afollestad:material-dialogs:0.7.3.2' + compile 'com.bugsnag:bugsnag-android:+' + //Self compiled .aar version of wishlist compile (name:'lib', ext:'aar') testCompile 'junit:junit:4.12' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 96c0a27ef..630a5df8e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,6 +4,7 @@ + @@ -388,6 +389,10 @@ + + diff --git a/app/src/main/java/com/github/pockethub/ui/MainActivity.java b/app/src/main/java/com/github/pockethub/ui/MainActivity.java index 44da81411..91e389058 100644 --- a/app/src/main/java/com/github/pockethub/ui/MainActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/MainActivity.java @@ -1,6 +1,5 @@ package com.github.pockethub.ui; -import static com.github.pockethub.ui.NavigationDrawerObject.TYPE_SEPERATOR; import android.app.SearchManager; import android.content.Context; import android.os.Bundle; @@ -16,6 +15,7 @@ import android.view.View; import android.view.Window; +import com.bugsnag.android.Bugsnag; import com.github.pockethub.R; import com.github.pockethub.accounts.AccountUtils; import com.github.pockethub.core.user.UserComparator; @@ -29,10 +29,12 @@ import com.google.inject.Inject; import com.google.inject.Provider; +import org.eclipse.egit.github.core.User; + import java.util.Collections; import java.util.List; -import org.eclipse.egit.github.core.User; +import static com.github.pockethub.ui.NavigationDrawerObject.TYPE_SEPERATOR; public class MainActivity extends BaseActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks, LoaderManager.LoaderCallbacks> { @@ -59,6 +61,7 @@ public class MainActivity extends BaseActivity implements NavigationDrawerFragme @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + Bugsnag.init(this); setContentView(R.layout.activity_main); setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0eed7b042..9f29e32f0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,6 +14,8 @@ limitations under the License. --> + + 071042af7240b1a939bfe921b07ccc6d Loading account & organizations failed From 558f07878219b19d48befe784dd937b3598c0498 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Wed, 9 Sep 2015 17:53:56 +0700 Subject: [PATCH 0571/1055] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e8b70268..20c8055c9 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ are welcomed and appreciated but will be thoroughly reviewed and discussed. **Pl 1. Create a github application (https://github.com/settings/applications/new) 2. Create a github.properties in the root folder of the repo -3. Add these three value too the github.properties +3. Add these three value to the github.properties ``` GITHUB_CLIENT=your_application_client_id From 7b6e71f62136402ce93b495452dd424c533b3a49 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Wed, 9 Sep 2015 17:55:35 +0700 Subject: [PATCH 0572/1055] Fix grammar. Nit stuff. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 20c8055c9..6c0378b71 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ are welcomed and appreciated but will be thoroughly reviewed and discussed. **Pl 1. Create a github application (https://github.com/settings/applications/new) 2. Create a github.properties in the root folder of the repo -3. Add these three value to the github.properties +3. Add these three values to the github.properties ``` GITHUB_CLIENT=your_application_client_id From 3b1935022332b5e58ff67ba69835cc1979094685 Mon Sep 17 00:00:00 2001 From: Henrik Date: Fri, 18 Sep 2015 23:29:00 +0200 Subject: [PATCH 0573/1055] Updated libs (Fixes some bugs) Added Application for adding credentials to the SDK RoboGuice Modules injects fixed Intents updated to new SDK --- app/build.gradle | 16 ++--- app/src/main/AndroidManifest.xml | 13 +--- .../java/com/github/pockethub/GitHub.java | 15 ++++ .../com/github/pockethub/GitHubModule.java | 14 ++-- .../java/com/github/pockethub/Intents.java | 71 +++++++++++-------- .../com/github/pockethub/ServicesModule.java | 10 ++- 6 files changed, 80 insertions(+), 59 deletions(-) create mode 100644 app/src/main/java/com/github/pockethub/GitHub.java diff --git a/app/build.gradle b/app/build.gradle index fc3a1848a..3f0dc0713 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,13 +19,13 @@ def isTravis = "true".equals(System.getenv("TRAVIS")) def preDexEnabled = "true".equals(System.getProperty("pre-dex", "true")) android { - compileSdkVersion 22 - buildToolsVersion '22.0.1' + compileSdkVersion 23 + buildToolsVersion '23.0.1' defaultConfig { applicationId 'com.github.pockethub' minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild versionName "${versionMajor}.${versionMinor}.${versionPatch}" @@ -80,19 +80,18 @@ def String getValue(Properties props, String name) { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.2.1' + compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.squareup.picasso:picasso:2.5.0' compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'org.roboguice:roboguice:2.0' compile 'com.github.kevinsawicki:http-request:5.6' compile 'com.google.code.gson:gson:2.3.1' compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.7.0.201502260915-r' - compile 'com.android.support:support-v4:22.2.1' + compile 'com.android.support:support-v4:23.0.1' compile ('com.google.inject.extensions:guice-assistedinject:3.0'){ exclude group: 'com.google.inject' } - - compile 'com.github.alorma:github-sdk:1.0.1' + compile 'com.github.alorma:github-sdk:1.2.0' compile 'com.viewpagerindicator:library:2.4.1@aar' compile 'com.squareup.okio:okio:1.1.0' compile 'com.squareup.retrofit:retrofit:1.9.0' @@ -105,6 +104,5 @@ dependencies { exclude group: 'commons-logging', module: 'commons-logging' exclude group: 'org.apache.httpcomponents', module: 'httpclient' } - - compile 'com.android.support:design:22.2.1' + compile 'com.android.support:design:23.0.1' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0babd081e..8782a3fd9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,7 +23,8 @@ android:hardwareAccelerated="false" android:icon="@drawable/app_icon" android:label="@string/app_name" - android:theme="@style/Theme.GitHub"> + android:theme="@style/Theme.GitHub" + android:name="com.github.pockethub.GitHub"> - - - - (store); } return store; } @Provides - GistStore gistStore(GistService service) { + GistStore gistStore(Context context) { GistStore store = gists != null ? gists.get() : null; if (store == null) { - store = new GistStore(service); + store = new GistStore(context); gists = new WeakReference<>(store); } return store; } @Provides - CommitStore commitStore(CommitService service) { + CommitStore commitStore(Context context) { CommitStore store = commits != null ? commits.get() : null; if (store == null) { - store = new CommitStore(service); + store = new CommitStore(context); commits = new WeakReference<>(store); } return store; diff --git a/app/src/main/java/com/github/pockethub/Intents.java b/app/src/main/java/com/github/pockethub/Intents.java index 3ace3f1ab..407232740 100644 --- a/app/src/main/java/com/github/pockethub/Intents.java +++ b/app/src/main/java/com/github/pockethub/Intents.java @@ -16,19 +16,18 @@ package com.github.pockethub; import android.content.Intent; +import android.os.Parcelable; -import org.eclipse.egit.github.core.Gist; -import org.eclipse.egit.github.core.GistFile; -import org.eclipse.egit.github.core.Issue; -import org.eclipse.egit.github.core.Repository; -import org.eclipse.egit.github.core.RepositoryId; -import org.eclipse.egit.github.core.User; +import com.alorma.github.sdk.bean.dto.response.Gist; +import com.alorma.github.sdk.bean.dto.response.GistFile; +import com.alorma.github.sdk.bean.dto.response.Issue; +import com.alorma.github.sdk.bean.dto.response.Repo; +import com.alorma.github.sdk.bean.dto.response.User; +import com.github.pockethub.util.InfoUtils; import java.io.Serializable; import java.util.ArrayList; -import static org.eclipse.egit.github.core.RepositoryId.createFromUrl; - /** * Helper for creating intents */ @@ -45,25 +44,25 @@ public class Intents { public static final String INTENT_EXTRA_PREFIX = INTENT_PREFIX + "extra."; /** - * Repository handle + * Repo handle */ public static final String EXTRA_REPOSITORY = INTENT_EXTRA_PREFIX + "REPOSITORY"; /** - * Repository ids collection handle + * Repo ids collection handle */ public static final String EXTRA_REPOSITORIES = INTENT_EXTRA_PREFIX + "REPOSITORIES"; /** - * Repository name + * Repo name */ public static final String EXTRA_REPOSITORY_NAME = INTENT_EXTRA_PREFIX + "REPOSITORY_NAME"; /** - * Repository owner + * Repo owner */ public static final String EXTRA_REPOSITORY_OWNER = INTENT_EXTRA_PREFIX + "REPOSITORY_OWNER"; @@ -177,15 +176,15 @@ public class Intents { public static final String EXTRA_PATH = INTENT_EXTRA_PREFIX + "PATH"; /** - * Resolve the {@link RepositoryId} referenced by the given intent + * Resolve the {@link Repo} referenced by the given intent * * @param intent * @return repository id */ - public static RepositoryId repoFrom(Intent intent) { + public static Repo repoFrom(Intent intent) { String repoName = intent.getStringExtra(EXTRA_REPOSITORY_NAME); String repoOwner = intent.getStringExtra(EXTRA_REPOSITORY_OWNER); - return RepositoryId.create(repoOwner, repoName); + return InfoUtils.createRepoFromData(repoOwner, repoName); } /** @@ -206,24 +205,13 @@ public Builder(String actionSuffix) { intent = new Intent(INTENT_PREFIX + actionSuffix); } - /** - * Add repository id to intent being built up - * - * @param repositoryId - * @return this builder - */ - public Builder repo(RepositoryId repositoryId) { - return add(EXTRA_REPOSITORY_NAME, repositoryId.getName()).add( - EXTRA_REPOSITORY_OWNER, repositoryId.getOwner()); - } - /** * Add repository to intent being built up * * @param repository * @return this builder */ - public Builder repo(Repository repository) { + public Builder repo(Repo repository) { return add(EXTRA_REPOSITORY, repository); } @@ -234,8 +222,8 @@ public Builder repo(Repository repository) { * @return this builder */ public Builder issue(Issue issue) { - return repo(createFromUrl(issue.getHtmlUrl())).add(EXTRA_ISSUE, - issue).add(EXTRA_ISSUE_NUMBER, issue.getNumber()); + return repo(InfoUtils.createRepoFromUrl(issue.html_url)).add(EXTRA_ISSUE, + issue).add(EXTRA_ISSUE_NUMBER, issue.number); } /** @@ -350,6 +338,31 @@ public Builder add(String fieldName, Serializable value) { return this; } + + /** + * Add extra field data value to intent being built up + * + * @param fieldName + * @param value + * @return this builder + */ + public Builder add(String fieldName, Parcelable value) { + intent.putExtra(fieldName, value); + return this; + } + + /** + * Add extra field data value to intent being built up + * + * @param fieldName + * @param value + * @return this builder + */ + public Builder add(String fieldName, ArrayList value) { + intent.putParcelableArrayListExtra(fieldName, value); + return this; + } + /** * Get built intent * diff --git a/app/src/main/java/com/github/pockethub/ServicesModule.java b/app/src/main/java/com/github/pockethub/ServicesModule.java index 9b754d498..0ef781239 100644 --- a/app/src/main/java/com/github/pockethub/ServicesModule.java +++ b/app/src/main/java/com/github/pockethub/ServicesModule.java @@ -15,13 +15,17 @@ */ package com.github.pockethub; +import android.content.Context; + +import com.alorma.github.sdk.bean.dto.response.Content; +import com.alorma.github.sdk.services.user.GetAuthUserClient; import com.github.pockethub.core.search.SearchUserService; import com.google.inject.AbstractModule; import com.google.inject.Provides; import java.io.IOException; -import org.eclipse.egit.github.core.User; +import com.alorma.github.sdk.bean.dto.response.User; import org.eclipse.egit.github.core.client.GitHubClient; import org.eclipse.egit.github.core.service.CollaboratorService; import org.eclipse.egit.github.core.service.CommitService; @@ -85,8 +89,8 @@ RepositoryService repoService(GitHubClient client) { } @Provides - User currentUser(UserService userService) throws IOException { - return userService.getUser(); + User currentUser(Context context) throws IOException { + return new GetAuthUserClient(context).executeSync(); } @Provides From f5b0aa39a73f7dc9d9586037a9992cd841896cb9 Mon Sep 17 00:00:00 2001 From: Henrik Date: Fri, 18 Sep 2015 23:30:46 +0200 Subject: [PATCH 0574/1055] Removed local TwoFactorAuth from app Updated LoginActivity to fit SDK changes Refactoring --- .../pockethub/accounts/AccountUtils.java | 23 +- .../pockethub/accounts/LoginActivity.java | 13 +- .../accounts/TwoFactorAuthActivity.java | 260 ------------------ .../accounts/TwoFactorAuthClient.java | 153 ----------- .../accounts/TwoFactorAuthException.java | 63 ----- 5 files changed, 29 insertions(+), 483 deletions(-) delete mode 100644 app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthActivity.java delete mode 100644 app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthClient.java delete mode 100644 app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthException.java diff --git a/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java b/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java index 5c8b2f474..bec370c4e 100644 --- a/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java +++ b/app/src/main/java/com/github/pockethub/accounts/AccountUtils.java @@ -32,10 +32,11 @@ import android.text.TextUtils; import android.util.Log; +import com.alorma.github.sdk.bean.dto.response.Organization; +import com.alorma.github.sdk.bean.dto.response.User; import com.github.pockethub.R; import com.github.pockethub.ui.LightAlertDialog; -import org.eclipse.egit.github.core.User; import org.eclipse.egit.github.core.client.RequestException; import java.io.IOException; @@ -103,7 +104,25 @@ public static boolean isUser(final Context context, final User user) { if (user == null) return false; - String login = user.getLogin(); + String login = user.login; + if (login == null) + return false; + + return login.equals(getLogin(context)); + } + + /** + * Is the given user the owner of the default account? + * + * @param context + * @param user + * @return true if default account user, false otherwise + */ + public static boolean isUser(final Context context, final Organization user) { + if (user == null) + return false; + + String login = user.login; if (login == null) return false; diff --git a/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java b/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java index 42955ef23..4f006a752 100644 --- a/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java +++ b/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java @@ -32,6 +32,9 @@ import com.alorma.github.basesdk.ApiClient; import com.alorma.github.basesdk.client.BaseClient; +import com.alorma.github.basesdk.client.GithubDeveloperCredentialsProvider; +import com.alorma.github.basesdk.client.credentials.GithubDeveloperCredentials; +import com.alorma.github.sdk.bean.dto.response.Organization; import com.alorma.github.sdk.bean.dto.response.Token; import com.alorma.github.sdk.login.AccountsHelper; import com.alorma.github.sdk.security.GitHub; @@ -47,7 +50,7 @@ import java.util.List; -import org.eclipse.egit.github.core.User; +import com.alorma.github.sdk.bean.dto.response.User; import retrofit.RetrofitError; import retrofit.client.Response; @@ -90,7 +93,7 @@ public static void configureSyncFor(Account account) { } public static class AccountLoader extends - AuthenticatedUserTask> { + AuthenticatedUserTask> { @Inject private AccountDataManager cache; @@ -100,7 +103,7 @@ protected AccountLoader(Context context) { } @Override - protected List run(Account account) throws Exception { + protected List run(Account account) throws Exception { return cache.getOrgs(true); } } @@ -183,10 +186,10 @@ private void openLoadingDialog() { } public void handleLogin() { - openLoginInBrowser(new GitHub(this)); + openLoginInBrowser(GithubDeveloperCredentials.getInstance().getProvider()); } - private void openLoginInBrowser(ApiClient client) { + private void openLoginInBrowser(GithubDeveloperCredentialsProvider client) { String initialScope = "user,public_repo,repo,delete_repo,notifications,gist"; HttpUrl.Builder url = new HttpUrl.Builder() .scheme("https") diff --git a/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthActivity.java b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthActivity.java deleted file mode 100644 index dc9becb97..000000000 --- a/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthActivity.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright 2013 GitHub Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.github.pockethub.accounts; - -import static android.content.DialogInterface.OnCancelListener; -import static android.view.KeyEvent.ACTION_DOWN; -import static android.view.KeyEvent.KEYCODE_ENTER; -import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE; -import static com.github.pockethub.accounts.AccountConstants.ACCOUNT_TYPE; -import static com.github.pockethub.accounts.LoginActivity.configureSyncFor; -import android.accounts.Account; -import android.accounts.AccountManager; -import android.app.AlertDialog; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.os.Bundle; -import android.text.Editable; -import android.text.Html; -import android.text.TextUtils; -import android.text.TextWatcher; -import android.text.method.LinkMovementMethod; -import android.util.Log; -import android.view.KeyEvent; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.EditText; -import android.widget.TextView; - -import com.github.kevinsawicki.wishlist.ViewFinder; -import com.github.pockethub.R; -import com.github.pockethub.ui.LightProgressDialog; -import com.github.pockethub.ui.TextWatcherAdapter; -import com.github.pockethub.ui.roboactivities.RoboActionBarActivity; - -import java.io.IOException; - -import org.eclipse.egit.github.core.User; -import org.eclipse.egit.github.core.service.OAuthService; -import org.eclipse.egit.github.core.service.UserService; - -import roboguice.util.RoboAsyncTask; - -/** - * Activity to enter two-factor authentication OTP code - */ -public class TwoFactorAuthActivity extends RoboActionBarActivity { - - /** - * Create intent to enter two-factor authentication code - * - * @param username - * @param password - * @return - */ - public static Intent createIntent(Context context, String username, String password) { - Intent intent = new Intent(context, TwoFactorAuthActivity.class); - intent.putExtra(PARAM_USERNAME, username); - intent.putExtra(PARAM_PASSWORD, password); - return intent; - } - - /** - * Exception sent back to calling Activity - */ - public static final String PARAM_EXCEPTION = "exception"; - - /** - * User name entered in login screen - */ - public static final String PARAM_USERNAME = "username"; - - /** - * Password entered in login screen - */ - public static final String PARAM_PASSWORD = "password"; - - private static final String TAG = "TwoFactorAuthActivity"; - - private AccountManager accountManager; - - private EditText otpCodeText; - - private RoboAsyncTask authenticationTask; - - private MenuItem loginItem; - - private String username; - - private String password; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.login_two_factor_auth); - - setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); - - accountManager = AccountManager.get(this); - - ViewFinder finder = new ViewFinder(this); - otpCodeText = finder.find(R.id.et_otp_code); - - final Intent intent = getIntent(); - username = intent.getStringExtra(PARAM_USERNAME); - password = intent.getStringExtra(PARAM_PASSWORD); - - TextView signupText = finder.find(R.id.tv_signup); - signupText.setMovementMethod(LinkMovementMethod.getInstance()); - signupText.setText(Html.fromHtml(getString(R.string.signup_link_two_factor_auth))); - - TextWatcher watcher = new TextWatcherAdapter() { - - @Override - public void afterTextChanged(Editable gitDirEditText) { - updateEnablement(); - } - }; - otpCodeText.addTextChangedListener(watcher); - - otpCodeText.setOnKeyListener(new View.OnKeyListener() { - - @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - if (event != null && ACTION_DOWN == event.getAction() - && keyCode == KEYCODE_ENTER && loginEnabled()) { - handleLogin(); - return true; - } else - return false; - } - }); - - otpCodeText.setOnEditorActionListener(new TextView.OnEditorActionListener() { - - @Override - public boolean onEditorAction(TextView v, int actionId, - KeyEvent event) { - if (actionId == IME_ACTION_DONE && loginEnabled()) { - handleLogin(); - return true; - } - return false; - } - }); - } - - @Override - protected void onResume() { - super.onResume(); - updateEnablement(); - } - - private boolean loginEnabled() { - Editable otpCode = otpCodeText.getText(); - return !TextUtils.isEmpty(otpCode) && otpCode.length() == 6; - } - - private void updateEnablement() { - if (loginItem != null) - loginItem.setEnabled(loginEnabled()); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.m_login: - handleLogin(); - return true; - default: - return super.onOptionsItemSelected(item); - } - } - - @Override - public boolean onCreateOptionsMenu(Menu optionsMenu) { - getMenuInflater().inflate(R.menu.login, optionsMenu); - loginItem = optionsMenu.findItem(R.id.m_login); - return true; - } - - private void handleLogin() { - final String otpCode = otpCodeText.getText().toString(); - - final AlertDialog dialog = LightProgressDialog.create(this, - R.string.login_activity_authenticating); - dialog.setCancelable(true); - dialog.setOnCancelListener(new OnCancelListener() { - - @Override - public void onCancel(DialogInterface dialog) { - if (authenticationTask != null) - authenticationTask.cancel(true); - } - }); - dialog.show(); - - authenticationTask = new RoboAsyncTask(this) { - - @Override - public User call() throws Exception { - TwoFactorAuthClient client = new TwoFactorAuthClient(); - client.setCredentials(username, password); - client.setOtpCode(otpCode); - - OAuthService service = new OAuthService(client); - String authToken = AccountAuthenticator.getAuthorization(service); - if (authToken == null) - authToken = AccountAuthenticator.createAuthorization(service); - client.setOAuth2Token(authToken); - - User user = new UserService(client).getUser(); - Account account = new Account(user.getLogin(), ACCOUNT_TYPE); - accountManager.addAccountExplicitly(account, password, null); - accountManager.setAuthToken(account, ACCOUNT_TYPE, authToken); - - configureSyncFor(account); - try { - new LoginActivity.AccountLoader(TwoFactorAuthActivity.this).call(); - } catch (IOException e) { - Log.d(TAG, "Exception loading organizations", e); - } - - return user; - } - - @Override - protected void onException(Exception e) throws RuntimeException { - dialog.dismiss(); - - Log.d(TAG, "Exception requesting handling two-factor authentication", e); - setResult(RESULT_CANCELED, new Intent().putExtra(PARAM_EXCEPTION, e)); - finish(); - } - - @Override - public void onSuccess(User user) { - dialog.dismiss(); - setResult(RESULT_OK); - finish(); - } - }; - authenticationTask.execute(); - } -} diff --git a/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthClient.java b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthClient.java deleted file mode 100644 index 31aa7a2c6..000000000 --- a/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthClient.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2013 GitHub Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.github.pockethub.accounts; - -import android.text.TextUtils; -import com.github.pockethub.DefaultClient; -import org.eclipse.egit.github.core.client.GitHubClient; -import org.eclipse.egit.github.core.client.GitHubRequest; -import org.eclipse.egit.github.core.client.GitHubResponse; - -import java.io.IOException; -import java.lang.reflect.Type; -import java.net.HttpURLConnection; - -/** - * {@link GitHubClient} extension that checks response headers to find - * two-factor authentication related ones - */ -public class TwoFactorAuthClient extends DefaultClient { - - /** - * Two-factor authentication code header - */ - protected static final String HEADER_OTP = "X-GitHub-OTP"; - - /** - * Two-factor authentication type by application - */ - public static final int TWO_FACTOR_AUTH_TYPE_APP = 1001; - - /** - * Two-factor authentication type by sms - */ - public static final int TWO_FACTOR_AUTH_TYPE_SMS = 1002; - - private String otpCode; - - public TwoFactorAuthClient() { - super(); - } - - /** - * Set OTP code which will be added to POST requests - * - * @param otpCode - */ - public void setOtpCode(String otpCode) { - this.otpCode = otpCode; - } - - /** - * Get response from URI and bind to specified type - * - * @param request - * @return response - * @throws java.io.IOException - */ - @Override - public GitHubResponse get(GitHubRequest request) throws IOException { - HttpURLConnection httpRequest = createGet(request.generateUri()); - if (!TextUtils.isEmpty(otpCode)) - httpRequest.setRequestProperty(HEADER_OTP, otpCode); - - try { - String accept = request.getResponseContentType(); - if (accept != null) - httpRequest.setRequestProperty(HEADER_ACCEPT, accept); - final int code = httpRequest.getResponseCode(); - updateRateLimits(httpRequest); - if (isOk(code)) - return new GitHubResponse(httpRequest, getBody(request, - getStream(httpRequest))); - if (isEmpty(code)) - return new GitHubResponse(httpRequest, null); - throw createException(getStream(httpRequest), code, - httpRequest.getResponseMessage()); - } catch (IOException e) { - throw checkTwoFactorAuthError(httpRequest, e); - } - } - - /** - * Post data to URI - * - * @param - * @param uri - * @param params - * @param type - * @return response - * @throws IOException - */ - @Override - public V post(final String uri, final Object params, final Type type) - throws IOException { - HttpURLConnection request = createPost(uri); - if (!TextUtils.isEmpty(otpCode)) - request.setRequestProperty(HEADER_OTP, otpCode); - - try { - return sendJson(request, params, type); - } catch (IOException e) { - throw checkTwoFactorAuthError(request, e); - } - } - - private IOException checkTwoFactorAuthError(HttpURLConnection request, IOException e) throws IOException { - String otpHeader = request.getHeaderField(HEADER_OTP); - if (!TextUtils.isEmpty(otpHeader) && otpHeader.contains("required")) - return createTwoFactorAuthException(e, otpHeader); - else - return e; - } - - private TwoFactorAuthException createTwoFactorAuthException( - IOException cause, String otpHeader) { - int twoFactorAuthType = -1; - if (otpHeader.contains("app")) - twoFactorAuthType = TWO_FACTOR_AUTH_TYPE_APP; - else if (otpHeader.contains("sms")) - twoFactorAuthType = TWO_FACTOR_AUTH_TYPE_SMS; - - return new TwoFactorAuthException(cause, twoFactorAuthType); - } - - private V sendJson(final HttpURLConnection request, - final Object params, final Type type) throws IOException { - sendParams(request, params); - final int code = request.getResponseCode(); - updateRateLimits(request); - if (isOk(code)) - if (type != null) - return parseJson(getStream(request), type); - else - return null; - if (isEmpty(code)) - return null; - throw createException(getStream(request), code, - request.getResponseMessage()); - } -} diff --git a/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthException.java b/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthException.java deleted file mode 100644 index 237525cd7..000000000 --- a/app/src/main/java/com/github/pockethub/accounts/TwoFactorAuthException.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2013 GitHub Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.github.pockethub.accounts; - -import java.io.IOException; - -/** - * Exception class to be thrown when server responds with a 401 and - * an X-GitHub-OTP: required;:2fa-type header. - * This exception wraps an {@link IOException} that is the actual exception - * that occurred when the request was made. - */ -public class TwoFactorAuthException extends IOException { - - /** - * serialVersionUID - */ - private static final long serialVersionUID = 3889626691109709714L; - - /** - * Cause exception - */ - protected final IOException cause; - - /** - * Two-factor authentication type - */ - protected final int twoFactorAuthType; - - /** - * Create two-factor authentification exception - * - * @param cause - * @param twoFactorAuthType - */ - public TwoFactorAuthException(IOException cause, int twoFactorAuthType) { - this.cause = cause; - this.twoFactorAuthType = twoFactorAuthType; - } - - @Override - public String getMessage() { - return cause != null ? cause.getMessage() : super.getMessage(); - } - - @Override - public IOException getCause() { - return cause; - } -} \ No newline at end of file From 435118e8d41edca5130abd334598bffa9fbdfb0d Mon Sep 17 00:00:00 2001 From: Henrik Date: Fri, 18 Sep 2015 23:32:05 +0200 Subject: [PATCH 0575/1055] Extra API payloads that the SDK didn't need, but we do --- .../com/github/pockethub/api/FollowEventPayload.java | 9 +++++++++ .../java/com/github/pockethub/api/GistEventPayload.java | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 app/src/main/java/com/github/pockethub/api/FollowEventPayload.java create mode 100644 app/src/main/java/com/github/pockethub/api/GistEventPayload.java diff --git a/app/src/main/java/com/github/pockethub/api/FollowEventPayload.java b/app/src/main/java/com/github/pockethub/api/FollowEventPayload.java new file mode 100644 index 000000000..57b4c0b23 --- /dev/null +++ b/app/src/main/java/com/github/pockethub/api/FollowEventPayload.java @@ -0,0 +1,9 @@ +package com.github.pockethub.api; + +import com.alorma.github.sdk.bean.dto.response.User; +import com.alorma.github.sdk.bean.dto.response.events.payload.GithubEventPayload; + +public class FollowEventPayload extends GithubEventPayload { + + public User target; +} diff --git a/app/src/main/java/com/github/pockethub/api/GistEventPayload.java b/app/src/main/java/com/github/pockethub/api/GistEventPayload.java new file mode 100644 index 000000000..bcf5bf401 --- /dev/null +++ b/app/src/main/java/com/github/pockethub/api/GistEventPayload.java @@ -0,0 +1,9 @@ +package com.github.pockethub.api; + +import com.alorma.github.sdk.bean.dto.response.Gist; +import com.alorma.github.sdk.bean.dto.response.events.payload.ActionEventPayload; + +public class GistEventPayload extends ActionEventPayload { + + public Gist gist; +} From a4b1f2c5d9ba11c5845cb7c0716c53fb5dc35a04 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Tue, 22 Sep 2015 15:57:34 +0700 Subject: [PATCH 0576/1055] Add logout function --- .../pockethub/accounts/LoginActivity.java | 14 ++++++---- .../com/github/pockethub/ui/MainActivity.java | 26 +++++++------------ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java b/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java index 42955ef23..4d7acf189 100644 --- a/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java +++ b/app/src/main/java/com/github/pockethub/accounts/LoginActivity.java @@ -15,7 +15,6 @@ */ package com.github.pockethub.accounts; -import static com.github.pockethub.accounts.AccountConstants.PROVIDER_AUTHORITY; import android.accounts.Account; import android.accounts.AccountManager; import android.app.AlertDialog; @@ -45,13 +44,15 @@ import com.google.inject.Inject; import com.squareup.okhttp.HttpUrl; -import java.util.List; - import org.eclipse.egit.github.core.User; +import java.util.List; + import retrofit.RetrofitError; import retrofit.client.Response; +import static com.github.pockethub.accounts.AccountConstants.PROVIDER_AUTHORITY; + /** * Activity to login */ @@ -130,8 +131,9 @@ public void onCreate(Bundle savedInstanceState) { accounts = accountManager.getAccountsByType(getString(R.string.account_type)); - if (accounts != null && accounts.length > 0) + if (accounts != null && accounts.length > 0) { openMain(); + } } @Override @@ -169,8 +171,10 @@ public void onFail(RetrofitError error) { } private void openMain() { - if(progressDialog != null) + if (progressDialog != null) { progressDialog.dismiss(); + } + Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); diff --git a/app/src/main/java/com/github/pockethub/ui/MainActivity.java b/app/src/main/java/com/github/pockethub/ui/MainActivity.java index ed3f9e08f..3e6928f58 100644 --- a/app/src/main/java/com/github/pockethub/ui/MainActivity.java +++ b/app/src/main/java/com/github/pockethub/ui/MainActivity.java @@ -1,9 +1,10 @@ package com.github.pockethub.ui; +import android.accounts.Account; +import android.accounts.AccountManager; import android.app.SearchManager; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; @@ -44,8 +45,6 @@ public class MainActivity extends BaseActivity implements NavigationDrawerFragme LoaderManager.LoaderCallbacks> { private static final String TAG = "MainActivity"; - public static final String STRING_LOGGED_IN = "log"; - public static boolean RESULT_LOG_IN = false; private NavigationDrawerFragment mNavigationDrawerFragment; @@ -60,9 +59,7 @@ public class MainActivity extends BaseActivity implements NavigationDrawerFragme private NavigationDrawerAdapter navigationAdapter; private User org; - - private SharedPreferences sp; - + @Inject private AvatarLoader avatars; @@ -72,13 +69,6 @@ protected void onCreate(Bundle savedInstanceState) { Bugsnag.init(this); setContentView(R.layout.activity_main); - sp = getSharedPreferences(STRING_LOGGED_IN,0); - boolean result = sp.getBoolean(STRING_LOGGED_IN, false); - if (result) { - Intent in = new Intent(this, LoginActivity.class); - startActivity(in); - } - setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); getSupportLoaderManager().initLoader(0, null, this); @@ -181,10 +171,12 @@ public void onNavigationDrawerItemSelected(int position) { fragment = new FilterListFragment(); break; case 5: - RESULT_LOG_IN = true; - SharedPreferences.Editor editor = sp.edit(); - editor.putBoolean(STRING_LOGGED_IN, RESULT_LOG_IN); - editor.commit(); + Account[] allAccounts = AccountManager.get(this).getAccounts(); + + for (Account account : allAccounts) { + AccountManager.get(this).removeAccount(account, null, null); + } + Intent in = new Intent(this, LoginActivity.class); in.addFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); From 1bb7109229c420ece555586eee129d6df99b7a28 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Wed, 23 Sep 2015 10:47:22 +0700 Subject: [PATCH 0577/1055] Update supporting libraries We also add jitpack.io for MaterialDialog. This addition will make Travis happy, and gives us the green badge we all like. --- app/build.gradle | 14 ++++++++------ build.gradle | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3aff5401b..cbcf45c6c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,13 +19,13 @@ def isTravis = "true".equals(System.getenv("TRAVIS")) def preDexEnabled = "true".equals(System.getProperty("pre-dex", "true")) android { - compileSdkVersion 22 + compileSdkVersion 23 buildToolsVersion '22.0.1' defaultConfig { applicationId 'com.github.pockethub' minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild versionName "${versionMajor}.${versionMinor}.${versionPatch}" @@ -80,14 +80,14 @@ def String getValue(Properties props, String name) { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.2.1' + compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.squareup.picasso:picasso:2.5.0' compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'org.roboguice:roboguice:2.0' compile 'com.github.kevinsawicki:http-request:5.6' compile 'com.google.code.gson:gson:2.3.1' compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.7.0.201502260915-r' - compile 'com.android.support:support-v4:22.2.1' + compile 'com.android.support:support-v4:23.0.1' compile ('com.google.inject.extensions:guice-assistedinject:3.0'){ exclude group: 'com.google.inject' } @@ -96,7 +96,9 @@ dependencies { compile 'com.viewpagerindicator:library:2.4.1@aar' compile 'com.squareup.okio:okio:1.1.0' compile 'com.squareup.retrofit:retrofit:1.9.0' - compile 'com.afollestad:material-dialogs:0.7.3.2' + compile('com.afollestad.material-dialogs:core:0.8.0.1@aar') { + transitive = true + } compile 'com.bugsnag:bugsnag-android:+' //Self compiled .aar version of wishlist @@ -108,5 +110,5 @@ dependencies { exclude group: 'org.apache.httpcomponents', module: 'httpclient' } - compile 'com.android.support:design:22.2.1' + compile 'com.android.support:design:23.0.1' } diff --git a/build.gradle b/build.gradle index 3c22d3d2e..4c86aafdb 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ buildscript { repositories { jcenter() + maven { url "https://jitpack.io" } } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' @@ -16,6 +17,7 @@ allprojects { repositories { maven { url "http://dl.bintray.com/populov/maven" } maven { url "https://repo.eclipse.org/content/groups/releases" } + maven { url "https://jitpack.io" } jcenter() } } From 786bab20e15127943568a36c48779276b4db8d04 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Wed, 23 Sep 2015 12:32:06 +0700 Subject: [PATCH 0578/1055] Add encrypted version for Travis build --- github.properties.enc | 1 + 1 file changed, 1 insertion(+) create mode 100644 github.properties.enc diff --git a/github.properties.enc b/github.properties.enc new file mode 100644 index 000000000..d51496b98 --- /dev/null +++ b/github.properties.enc @@ -0,0 +1 @@ + L_;V8\"#=iۭ 2J;ެc_&lԻ,W/nb22Lwh so!IU(UP4\hkaq1y!/fAD[UGJ1=-efb$Kat \ No newline at end of file From efb4cc3404e22b9adf94e73eb4fc784d90e12ec4 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Wed, 23 Sep 2015 12:33:03 +0700 Subject: [PATCH 0579/1055] Include github.properties --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index edc8385d6..f2a0d5549 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,5 +13,7 @@ notifications: sudo: false +before_script: + - openssl aes-256-cbc -K $encrypted_7e1c958561a2_key -iv $encrypted_7e1c958561a2_iv -in github.properties.enc -out github.properties -d script: - ./gradlew clean build From d21f0229333fff137b38b9bea62385adc3dd7531 Mon Sep 17 00:00:00 2001 From: Fadil Sutomo Date: Wed, 23 Sep 2015 12:38:07 +0700 Subject: [PATCH 0580/1055] Change sdk to v23 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f2a0d5549..c706a2d71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: android android: components: - platform-tools - - android-22 + - android-23 - build-tools-22.0.1 - extra From 8a648ca7b69b1f58a9cb8dc177849170cb3d1bcd Mon Sep 17 00:00:00 2001 From: Henrik Date: Wed, 23 Sep 2015 16:25:51 +0200 Subject: [PATCH 0581/1055] Update core models --- .../pockethub/core/NoSuchPageException.java | 21 ++++ .../github/pockethub/core/PageIterator.java | 98 +++++++++++++++++++ .../github/pockethub/core/ResourcePager.java | 7 +- .../github/pockethub/core/code/FullTree.java | 40 ++++---- .../pockethub/core/commit/FullCommit.java | 26 ++--- .../pockethub/core/commit/FullCommitFile.java | 8 +- .../github/pockethub/core/gist/FullGist.java | 7 +- .../pockethub/core/issue/FullIssue.java | 10 +- .../github/pockethub/util/AvatarLoader.java | 32 +++--- .../github/pockethub/util/ConvertUtils.java | 14 +++ .../pockethub/util/HttpImageGetter.java | 54 ++++++++-- .../com/github/pockethub/util/InfoUtils.java | 93 ++++++++++++++++++ .../github/pockethub/util/RequestUtils.java | 40 ++++++++ .../github/pockethub/util/SourceEditor.java | 7 +- .../com/github/pockethub/util/TimeUtils.java | 24 +++++ 15 files changed, 410 insertions(+), 71 deletions(-) create mode 100644 app/src/main/java/com/github/pockethub/core/NoSuchPageException.java create mode 100644 app/src/main/java/com/github/pockethub/core/PageIterator.java create mode 100644 app/src/main/java/com/github/pockethub/util/ConvertUtils.java create mode 100644 app/src/main/java/com/github/pockethub/util/InfoUtils.java create mode 100644 app/src/main/java/com/github/pockethub/util/RequestUtils.java diff --git a/app/src/main/java/com/github/pockethub/core/NoSuchPageException.java b/app/src/main/java/com/github/pockethub/core/NoSuchPageException.java new file mode 100644 index 000000000..298078ca6 --- /dev/null +++ b/app/src/main/java/com/github/pockethub/core/NoSuchPageException.java @@ -0,0 +1,21 @@ +package com.github.pockethub.core; + +import java.io.IOException; +import java.util.NoSuchElementException; + +public class NoSuchPageException extends NoSuchElementException { + + protected final IOException cause; + + public NoSuchPageException(IOException cause) { + this.cause = cause; + } + + public String getMessage() { + return this.cause != null ? this.cause.getMessage() : super.getMessage(); + } + + public IOException getCause() { + return this.cause; + } +} diff --git a/app/src/main/java/com/github/pockethub/core/PageIterator.java b/app/src/main/java/com/github/pockethub/core/PageIterator.java new file mode 100644 index 000000000..c23671544 --- /dev/null +++ b/app/src/main/java/com/github/pockethub/core/PageIterator.java @@ -0,0 +1,98 @@ +package com.github.pockethub.core; + +import android.net.Uri; + +import com.alorma.github.sdk.services.client.GithubClient; + +import org.eclipse.egit.github.core.util.UrlUtils; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +public class PageIterator implements Iterator>, Iterable>{ + + protected GitHubRequest> request; + protected int nextPage; + protected int lastPage; + protected Uri next; + protected Uri last; + + public PageIterator(GitHubRequest> request, int nextPage) { + this.request = request; + this.nextPage = this.lastPage = nextPage; + this.next = Uri.EMPTY; + } + + protected int parsePageNumber(Uri uri) { + if(uri != null && uri != Uri.EMPTY) { + + String param = uri.getQueryParameter("page"); + if(param != null && param.length() != 0) { + try { + return Integer.parseInt(param); + } catch (NumberFormatException var4) { + return -1; + } + } else { + return -1; + } + } else { + return -1; + } + } + + public int getNextPage() { + return this.nextPage; + } + + public int getLastPage() { + return this.lastPage; + } + + public boolean hasNext() { + return this.nextPage == 0 || this.next != null; + } + + public void remove() { + throw new UnsupportedOperationException("Remove not supported"); + } + + public Collection next() { + if(!this.hasNext()) { + throw new NoSuchElementException(); + } else { + List resources = null; + GithubClient client = request.execute(nextPage); + Object response = client.executeSync(); + if(response != null) + resources = (List) response; + + if(resources == null) + resources = Collections.emptyList(); + + ++this.nextPage; + this.last = client.last; + this.lastPage = parsePageNumber(last); + this.next = client.next; + this.nextPage = parsePageNumber(next); + return (Collection)resources; + } + } + + public GitHubRequest> getRequest() { + return this.request; + } + + public Iterator> iterator() { + return this; + } + + public interface GitHubRequest{ + GithubClient execute(int page); + } +} diff --git a/app/src/main/java/com/github/pockethub/core/ResourcePager.java b/app/src/main/java/com/github/pockethub/core/ResourcePager.java index c7b14ea1d..c6391810a 100644 --- a/app/src/main/java/com/github/pockethub/core/ResourcePager.java +++ b/app/src/main/java/com/github/pockethub/core/ResourcePager.java @@ -15,6 +15,8 @@ */ package com.github.pockethub.core; +import com.alorma.github.sdk.bean.dto.response.GithubEvent; + import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -22,9 +24,6 @@ import java.util.List; import java.util.Map; -import org.eclipse.egit.github.core.client.NoSuchPageException; -import org.eclipse.egit.github.core.client.PageIterator; - /** * Generic resource pager for elements with an id that can be paged * @@ -170,5 +169,5 @@ protected E register(final E resource) { * @return iterator */ public abstract PageIterator createIterator(final int page, - final int size); + final int size); } diff --git a/app/src/main/java/com/github/pockethub/core/code/FullTree.java b/app/src/main/java/com/github/pockethub/core/code/FullTree.java index 0f741d75d..0d4d7d4c0 100644 --- a/app/src/main/java/com/github/pockethub/core/code/FullTree.java +++ b/app/src/main/java/com/github/pockethub/core/code/FullTree.java @@ -20,17 +20,20 @@ import static org.eclipse.egit.github.core.TreeEntry.TYPE_TREE; import android.text.TextUtils; +import com.alorma.github.sdk.bean.dto.response.GitReference; +import com.alorma.github.sdk.bean.dto.response.GitTree; +import com.alorma.github.sdk.bean.dto.response.GitTreeEntry; +import com.alorma.github.sdk.bean.dto.response.GitTreeType; import com.github.pockethub.core.commit.CommitUtils; import com.github.pockethub.core.ref.RefUtils; +import com.google.gson.Gson; + +import org.eclipse.egit.github.core.Tree; import java.util.List; import java.util.Map; import java.util.TreeMap; -import org.eclipse.egit.github.core.Reference; -import org.eclipse.egit.github.core.Tree; -import org.eclipse.egit.github.core.TreeEntry; - /** * {@link Tree} with additional information */ @@ -49,7 +52,7 @@ public static class Entry implements Comparable { /** * Raw tree entry */ - public final TreeEntry entry; + public final GitTreeEntry entry; /** * Name @@ -62,10 +65,10 @@ private Entry() { this.name = null; } - private Entry(TreeEntry entry, Folder parent) { + private Entry(GitTreeEntry entry, Folder parent) { this.entry = entry; this.parent = parent; - this.name = CommitUtils.getName(entry.getPath()); + this.name = CommitUtils.getName(entry.path); } @Override @@ -95,11 +98,11 @@ private Folder() { super(); } - private Folder(TreeEntry entry, Folder parent) { + private Folder(GitTreeEntry entry, Folder parent) { super(entry, parent); } - private void addFile(TreeEntry entry, String[] pathSegments, int index) { + private void addFile(GitTreeEntry entry, String[] pathSegments, int index) { if (index == pathSegments.length - 1) { Entry file = new Entry(entry, this); files.put(file.name, file); @@ -110,7 +113,7 @@ private void addFile(TreeEntry entry, String[] pathSegments, int index) { } } - private void addFolder(TreeEntry entry, String[] pathSegments, int index) { + private void addFolder(GitTreeEntry entry, String[] pathSegments, int index) { if (index == pathSegments.length - 1) { Folder folder = new Folder(entry, this); folders.put(folder.name, folder); @@ -121,9 +124,9 @@ private void addFolder(TreeEntry entry, String[] pathSegments, int index) { } } - private void add(final TreeEntry entry) { - String type = entry.getType(); - String path = entry.getPath(); + private void add(final GitTreeEntry entry) { + String type = entry.type.toString(); + String path = entry.path; if (TextUtils.isEmpty(path)) return; @@ -154,7 +157,7 @@ private void add(final TreeEntry entry) { /** * Tree */ - public final Tree tree; + public final GitTree tree; /** * Root folder @@ -164,7 +167,7 @@ private void add(final TreeEntry entry) { /** * Reference */ - public final Reference reference; + public final GitReference reference; /** * Branch where tree is present @@ -177,15 +180,16 @@ private void add(final TreeEntry entry) { * @param tree * @param reference */ - public FullTree(final Tree tree, final Reference reference) { + public FullTree(final GitTree tree, final GitReference reference) { this.tree = tree; this.reference = reference; this.branch = RefUtils.getName(reference); root = new Folder(); - List entries = tree.getTree(); + List entries = tree.tree; if (entries != null && !entries.isEmpty()) - for (TreeEntry entry : entries) + for (GitTreeEntry entry : entries) { root.add(entry); + } } } diff --git a/app/src/main/java/com/github/pockethub/core/commit/FullCommit.java b/app/src/main/java/com/github/pockethub/core/commit/FullCommit.java index aeb09e2ce..f226854e8 100644 --- a/app/src/main/java/com/github/pockethub/core/commit/FullCommit.java +++ b/app/src/main/java/com/github/pockethub/core/commit/FullCommit.java @@ -17,6 +17,10 @@ import android.text.TextUtils; +import com.alorma.github.sdk.bean.dto.response.Commit; +import com.alorma.github.sdk.bean.dto.response.CommitComment; +import com.alorma.github.sdk.bean.dto.response.CommitFile; + import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; @@ -24,10 +28,6 @@ import java.util.Iterator; import java.util.List; -import org.eclipse.egit.github.core.CommitComment; -import org.eclipse.egit.github.core.CommitFile; -import org.eclipse.egit.github.core.RepositoryCommit; - /** * Commit model with comments */ @@ -36,7 +36,7 @@ public class FullCommit extends ArrayList implements private static final long serialVersionUID = 2470370479577730822L; - private final RepositoryCommit commit; + private final Commit commit; private final List files; @@ -45,9 +45,9 @@ public class FullCommit extends ArrayList implements * * @param commit */ - public FullCommit(final RepositoryCommit commit) { + public FullCommit(final Commit commit) { this.commit = commit; - List rawFiles = commit.getFiles(); + List rawFiles = commit.files; if (rawFiles != null && !rawFiles.isEmpty()) { files = new ArrayList<>(rawFiles.size()); for (CommitFile file : rawFiles) @@ -62,11 +62,11 @@ public FullCommit(final RepositoryCommit commit) { * @param commit * @param comments */ - public FullCommit(final RepositoryCommit commit, + public FullCommit(final Commit commit, final Collection comments) { this.commit = commit; - List rawFiles = commit.getFiles(); + List rawFiles = commit.files; boolean hasComments = comments != null && !comments.isEmpty(); boolean hasFiles = rawFiles != null && !rawFiles.isEmpty(); if (hasFiles) { @@ -77,7 +77,7 @@ public FullCommit(final RepositoryCommit commit, FullCommitFile full = new FullCommitFile(file); while (iterator.hasNext()) { CommitComment comment = iterator.next(); - if (file.getFilename().equals(comment.getPath())) { + if (file.getFileName().equals(comment.path)) { full.add(comment); iterator.remove(); } @@ -97,13 +97,13 @@ public FullCommit(final RepositoryCommit commit, @Override public boolean add(final CommitComment comment) { - String path = comment.getPath(); + String path = comment.path; if (TextUtils.isEmpty(path)) return super.add(comment); else { boolean added = false; for (FullCommitFile file : files) - if (path.equals(file.getFile().getFilename())) { + if (path.equals(file.getFile().filename)) { file.add(comment); added = true; break; @@ -124,7 +124,7 @@ public List getFiles() { /** * @return commit */ - public RepositoryCommit getCommit() { + public Commit getCommit() { return commit; } } diff --git a/app/src/main/java/com/github/pockethub/core/commit/FullCommitFile.java b/app/src/main/java/com/github/pockethub/core/commit/FullCommitFile.java index daf3353df..6cfc2a6af 100644 --- a/app/src/main/java/com/github/pockethub/core/commit/FullCommitFile.java +++ b/app/src/main/java/com/github/pockethub/core/commit/FullCommitFile.java @@ -17,13 +17,13 @@ import android.util.SparseArray; +import com.alorma.github.sdk.bean.dto.response.CommitComment; +import com.alorma.github.sdk.bean.dto.response.CommitFile; + import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.eclipse.egit.github.core.CommitComment; -import org.eclipse.egit.github.core.CommitFile; - /** * Commit file with comments */ @@ -62,7 +62,7 @@ public List get(final int line) { * @return this file */ public FullCommitFile add(final CommitComment comment) { - int line = comment.getPosition(); + int line = comment.position; if (line >= 0) { List lineComments = comments.get(line); if (lineComments == null) { diff --git a/app/src/main/java/com/github/pockethub/core/gist/FullGist.java b/app/src/main/java/com/github/pockethub/core/gist/FullGist.java index 464776531..d6ca25a41 100644 --- a/app/src/main/java/com/github/pockethub/core/gist/FullGist.java +++ b/app/src/main/java/com/github/pockethub/core/gist/FullGist.java @@ -20,12 +20,13 @@ import java.util.Collection; import org.eclipse.egit.github.core.Comment; -import org.eclipse.egit.github.core.Gist; +import com.alorma.github.sdk.bean.dto.response.Gist; +import com.alorma.github.sdk.bean.dto.response.GithubComment; /** * Gist model with comments and starred status */ -public class FullGist extends ArrayList implements Serializable { +public class FullGist extends ArrayList implements Serializable { private static final long serialVersionUID = -5966699489498437000L; @@ -41,7 +42,7 @@ public class FullGist extends ArrayList implements Serializable { * @param comments */ public FullGist(final Gist gist, final boolean starred, - final Collection comments) { + final Collection comments) { super(comments); this.starred = starred; diff --git a/app/src/main/java/com/github/pockethub/core/issue/FullIssue.java b/app/src/main/java/com/github/pockethub/core/issue/FullIssue.java index 875233e2b..178abf634 100644 --- a/app/src/main/java/com/github/pockethub/core/issue/FullIssue.java +++ b/app/src/main/java/com/github/pockethub/core/issue/FullIssue.java @@ -19,14 +19,14 @@ import java.util.ArrayList; import java.util.Collection; -import org.eclipse.egit.github.core.Comment; -import org.eclipse.egit.github.core.Issue; -import org.eclipse.egit.github.core.IssueEvent; +import com.alorma.github.sdk.bean.dto.response.GithubComment; +import com.alorma.github.sdk.bean.dto.response.Issue; +import com.alorma.github.sdk.bean.issue.IssueEvent; /** * Issue model with comments */ -public class FullIssue extends ArrayList implements Serializable { +public class FullIssue extends ArrayList implements Serializable { private static final long serialVersionUID = 4586476132467323827L; @@ -41,7 +41,7 @@ public class FullIssue extends ArrayList implements Serializable { * @param comments * @param events */ - public FullIssue(final Issue issue, final Collection comments, final Collection events) { + public FullIssue(final Issue issue, final Collection comments, final Collection events) { super(comments); this.events = events; diff --git a/app/src/main/java/com/github/pockethub/util/AvatarLoader.java b/app/src/main/java/com/github/pockethub/util/AvatarLoader.java index 3ae5439e5..99cac42c4 100644 --- a/app/src/main/java/com/github/pockethub/util/AvatarLoader.java +++ b/app/src/main/java/com/github/pockethub/util/AvatarLoader.java @@ -24,6 +24,9 @@ import android.util.Log; import android.widget.ImageView; +import com.alorma.github.sdk.bean.dto.response.Contributor; +import com.alorma.github.sdk.bean.dto.response.Organization; +import com.alorma.github.sdk.bean.dto.response.User; import com.github.pockethub.R; import com.google.inject.Inject; import com.squareup.okhttp.Cache; @@ -37,10 +40,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicReference; -import org.eclipse.egit.github.core.CommitUser; -import org.eclipse.egit.github.core.Contributor; -import org.eclipse.egit.github.core.User; - import roboguice.util.RoboAsyncTask; /** @@ -123,7 +122,7 @@ public void bind(final ActionBar actionBar, final AtomicReference userRefe if (user == null) return; - String avatarUrl = user.getAvatarUrl(); + String avatarUrl = user.avatar_url; if (TextUtils.isEmpty(avatarUrl)) return; @@ -163,10 +162,10 @@ public void bind(final ImageView view, final User user) { * Bind view to image at URL * * @param view The ImageView that is to display the user's avatar. - * @param user A CommitUser object that points to the desired user. + * @param org A User object that points to the desired user. */ - public void bind(final ImageView view, final CommitUser user) { - bind(view, getAvatarUrl(user)); + public void bind(final ImageView view, final Organization org) { + bind(view, getAvatarUrl(org)); } /** @@ -176,7 +175,7 @@ public void bind(final ImageView view, final CommitUser user) { * @param contributor A Contributor object that points to the desired user. */ public void bind(final ImageView view, final Contributor contributor) { - bind(view, contributor.getAvatarUrl()); + bind(view, contributor.author.avatar_url); } private void bind(final ImageView view, String url) { @@ -200,15 +199,22 @@ private String getAvatarUrl(User user) { if (user == null) return null; - String avatarUrl = user.getAvatarUrl(); + String avatarUrl = user.avatar_url; if (TextUtils.isEmpty(avatarUrl)) { - avatarUrl = getAvatarUrl(GravatarUtils.getHash(user.getEmail())); + avatarUrl = getAvatarUrl(GravatarUtils.getHash(user.email)); } return avatarUrl; } - private String getAvatarUrl(CommitUser user) { - return getAvatarUrl(GravatarUtils.getHash(user.getEmail())); + private String getAvatarUrl(Organization org) { + if (org == null) + return null; + + String avatarUrl = org.avatar_url; + if (TextUtils.isEmpty(avatarUrl)) { + avatarUrl = getAvatarUrl(GravatarUtils.getHash(org.email)); + } + return avatarUrl; } private String getAvatarUrl(String id) { diff --git a/app/src/main/java/com/github/pockethub/util/ConvertUtils.java b/app/src/main/java/com/github/pockethub/util/ConvertUtils.java new file mode 100644 index 000000000..7cda4b266 --- /dev/null +++ b/app/src/main/java/com/github/pockethub/util/ConvertUtils.java @@ -0,0 +1,14 @@ +package com.github.pockethub.util; + +import com.alorma.github.sdk.bean.dto.response.Repo; +import com.alorma.github.sdk.bean.dto.response.User; + +public class ConvertUtils { + public static Repo eventRepoToRepo(Repo repo) { + String[] ref = repo.name.split("/"); + repo.owner = new User(); + repo.owner.login = ref[0]; + repo.name = ref[1]; + return repo; + } +} diff --git a/app/src/main/java/com/github/pockethub/util/HttpImageGetter.java b/app/src/main/java/com/github/pockethub/util/HttpImageGetter.java index dd01a2beb..795ad1d7d 100644 --- a/app/src/main/java/com/github/pockethub/util/HttpImageGetter.java +++ b/app/src/main/java/com/github/pockethub/util/HttpImageGetter.java @@ -19,6 +19,7 @@ import static android.view.View.GONE; import static android.view.View.VISIBLE; import static java.lang.Integer.MAX_VALUE; +import static java.lang.Integer.valueOf; import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_DEFAULT; import android.accounts.Account; import android.content.Context; @@ -26,11 +27,15 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.text.Html; import android.text.Html.ImageGetter; import android.text.TextUtils; import android.util.Base64; import android.widget.TextView; +import com.alorma.github.basesdk.client.BaseClient; +import com.alorma.github.sdk.bean.dto.request.RequestMarkdownDTO; +import com.alorma.github.sdk.services.content.GetMarkdownClient; import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.http.HttpRequest.HttpRequestException; import com.github.pockethub.R; @@ -47,6 +52,9 @@ import org.eclipse.egit.github.core.RepositoryId; import org.eclipse.egit.github.core.service.ContentsService; +import retrofit.RetrofitError; +import retrofit.client.Response; + /** * Getter for an image */ @@ -106,7 +114,7 @@ private HttpImageGetter show(final TextView view, final CharSequence html) { if (TextUtils.isEmpty(html)) return hide(view); - view.setText(html); + view.setText(trim(html)); view.setVisibility(VISIBLE); view.setTag(null); return this; @@ -119,6 +127,13 @@ private HttpImageGetter hide(final TextView view) { return this; } + //All comments end with "\n\n" removing 2 chars + private CharSequence trim(CharSequence val){ + if(val.charAt(val.length()-1) == '\n' && val.charAt(val.length()-2) == '\n') + val = val.subSequence(0, val.length()-2); + return val; + } + /** * Encode given HTML string and map it to the given id * @@ -164,15 +179,38 @@ public HttpImageGetter bind(final TextView view, final String html, encoded = rawHtmlCache.get(id); if (encoded == null) { - encoded = HtmlUtils.encode(html, loading); - if (containsImages(html)) - rawHtmlCache.put(id, encoded); - else { - rawHtmlCache.remove(id); - fullHtmlCache.put(id, encoded); - return show(view, encoded); + if (!html.matches("<[a-z][\\s\\S]*>")) { + RequestMarkdownDTO markdownDTO = new RequestMarkdownDTO(); + markdownDTO.text = html; + GetMarkdownClient markdownClient = new GetMarkdownClient(context, markdownDTO); + markdownClient.setOnResultCallback(new BaseClient.OnResultCallback() { + @Override + public void onResponseOk(String data, Response response) { + continueBind(view, data, id); + } + + @Override + public void onFail(RetrofitError retrofitError) { + continueBind(view, html, id); + } + }); + markdownClient.execute(); + } else { + return continueBind(view, html, id); } } + return this; + } + + private HttpImageGetter continueBind(final TextView view, final String html, final Object id){ + CharSequence encoded = HtmlUtils.encode(html, loading); + if (containsImages(html)) + rawHtmlCache.put(id, encoded); + else { + rawHtmlCache.remove(id); + fullHtmlCache.put(id, encoded); + return show(view, encoded); + } if (TextUtils.isEmpty(encoded)) return hide(view); diff --git a/app/src/main/java/com/github/pockethub/util/InfoUtils.java b/app/src/main/java/com/github/pockethub/util/InfoUtils.java new file mode 100644 index 000000000..7e4f55881 --- /dev/null +++ b/app/src/main/java/com/github/pockethub/util/InfoUtils.java @@ -0,0 +1,93 @@ +package com.github.pockethub.util; + +import com.alorma.github.sdk.bean.dto.response.Issue; +import com.alorma.github.sdk.bean.dto.response.Repo; +import com.alorma.github.sdk.bean.dto.response.User; +import com.alorma.github.sdk.bean.info.CommitInfo; +import com.alorma.github.sdk.bean.info.IssueInfo; +import com.alorma.github.sdk.bean.info.RepoInfo; + +public class InfoUtils { + + public static RepoInfo createRepoInfo(Repo repo) { + return createRepoInfo(repo, repo.default_branch); + } + + public static RepoInfo createRepoInfo(Repo repo, String branch) { + RepoInfo repoInfo = new RepoInfo(); + repoInfo.permissions = repo.permissions; + repoInfo.branch = branch; + repoInfo.name = repo.name; + repoInfo.owner = repo.owner.login; + return repoInfo; + } + + public static IssueInfo createIssueInfo(Repo repo, Issue issue) { + IssueInfo issueInfo = new IssueInfo(createRepoInfo(repo)); + if (issue != null) { + issueInfo.num = issue.number; + issueInfo.state = issue.state; + issueInfo.commentNum = issue.comments; + } + return issueInfo; + } + + public static IssueInfo createIssueInfo(Repo repo, int issueNumber) { + IssueInfo issueInfo = new IssueInfo(createRepoInfo(repo)); + issueInfo.num = issueNumber; + return issueInfo; + } + + public static Repo createRepoFromUrl(String url) { + if (url == null || url.length() == 0) + return null; + String owner = null; + String name = null; + for (String segment : url.split("/")) //$NON-NLS-1$ + if (segment.length() > 0) + if (owner == null) + owner = segment; + else if (name == null) + name = segment; + else + break; + + if (owner != null && owner.length() > 0 && name != null && name.length() > 0) { + Repo repo = new Repo(); + User user = new User(); + user.login = owner; + repo.owner = user; + repo.name = name; + return repo; + } else { + return null; + } + } + + public static String createRepoId(Repo repo) { + if(repo.name.contains("/")) + return repo.name; + else + return createRepoId(repo.owner.login, repo.name); + } + + public static String createRepoId(String owner, String name) { + return owner + "/" + name; + } + + public static Repo createRepoFromData(String repoOwner, String repoName) { + Repo repo = new Repo(); + User user = new User(); + user.login = repoOwner; + repo.owner = user; + repo.name = repoName; + return repo; + } + + public static CommitInfo createCommitInfo(Repo repo, String sha) { + CommitInfo commitInfo = new CommitInfo(); + commitInfo.repoInfo = createRepoInfo(repo); + commitInfo.sha = sha; + return commitInfo; + } +} diff --git a/app/src/main/java/com/github/pockethub/util/RequestUtils.java b/app/src/main/java/com/github/pockethub/util/RequestUtils.java new file mode 100644 index 000000000..eec64069c --- /dev/null +++ b/app/src/main/java/com/github/pockethub/util/RequestUtils.java @@ -0,0 +1,40 @@ +package com.github.pockethub.util; + +import com.alorma.github.sdk.bean.dto.request.CommitCommentRequest; +import com.alorma.github.sdk.bean.dto.request.EditGistRequestDTO; +import com.alorma.github.sdk.bean.dto.request.IssueRequest; +import com.alorma.github.sdk.bean.dto.request.RequestMarkdownDTO; +import com.alorma.github.sdk.bean.dto.response.CommitComment; +import com.alorma.github.sdk.bean.dto.response.Gist; +import com.alorma.github.sdk.bean.dto.response.Issue; +import com.alorma.github.sdk.bean.dto.response.Label; + +public class RequestUtils { + public static EditGistRequestDTO editGist(Gist gist) { + EditGistRequestDTO editGistRequestDTO = new EditGistRequestDTO(); + editGistRequestDTO.description = gist.description; + editGistRequestDTO.files = gist.files; + return editGistRequestDTO; + } + + public static RequestMarkdownDTO markdown(String raw) { + RequestMarkdownDTO requestMarkdownDTO = new RequestMarkdownDTO(); + requestMarkdownDTO.text = raw; + return requestMarkdownDTO; + } + + public static IssueRequest issueFull(Issue issue, String body, String title) { + IssueRequest request = new IssueRequest(); + request.body = body; + request.title = title; + request.assignee = issue.user.login; + request.milestone = issue.milestone.number; + request.state = issue.state; + request.labels = new String[request.labels.length]; + + for (int i = 0; i < request.labels.length; i++) + request.labels[i] = issue.labels.get(i).name; + return request; + } + +} diff --git a/app/src/main/java/com/github/pockethub/util/SourceEditor.java b/app/src/main/java/com/github/pockethub/util/SourceEditor.java index 9c4e8c176..b7357c2ba 100644 --- a/app/src/main/java/com/github/pockethub/util/SourceEditor.java +++ b/app/src/main/java/com/github/pockethub/util/SourceEditor.java @@ -25,6 +25,7 @@ import android.webkit.WebView; import android.webkit.WebViewClient; +import com.alorma.github.sdk.bean.dto.response.GitBlob; import com.github.pockethub.ui.user.UriLauncherActivity; import java.io.UnsupportedEncodingException; @@ -184,11 +185,11 @@ private void loadSource() { * @param blob * @return this editor */ - public SourceEditor setSource(final String name, final Blob blob) { - String content = blob.getContent(); + public SourceEditor setSource(final String name, final GitBlob blob) { + String content = blob.content; if (content == null) content = ""; - boolean encoded = !TextUtils.isEmpty(content) && ENCODING_BASE64.equals(blob.getEncoding()); + boolean encoded = !TextUtils.isEmpty(content) && ENCODING_BASE64.equals(blob.encoding); return setSource(name, content, encoded); } diff --git a/app/src/main/java/com/github/pockethub/util/TimeUtils.java b/app/src/main/java/com/github/pockethub/util/TimeUtils.java index 75146a404..449799725 100644 --- a/app/src/main/java/com/github/pockethub/util/TimeUtils.java +++ b/app/src/main/java/com/github/pockethub/util/TimeUtils.java @@ -21,7 +21,11 @@ import static android.text.format.DateUtils.MINUTE_IN_MILLIS; import android.text.format.DateUtils; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; /** * Utilities for dealing with dates and times @@ -43,4 +47,24 @@ public static CharSequence getRelativeTime(final Date date) { else return "just now"; } + + public static CharSequence getRelativeTime(final String date) { + return getRelativeTime(stringToDate(date)); + } + + public static Date stringToDate(String value){ + DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.getDefault()); + Date date = null; + try { + date = format.parse(value); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + public static String dateToString(Date value){ + DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.getDefault()); + return format.format(value); + } } From 3cf1239c8ea9749b446af696e093490146b00466 Mon Sep 17 00:00:00 2001 From: Henrik Date: Wed, 23 Sep 2015 16:31:57 +0200 Subject: [PATCH 0582/1055] Adapters updated to use new SDK --- .../pockethub/ui/NavigationDrawerAdapter.java | 12 +- .../ui/comment/CommentListAdapter.java | 60 +++++---- .../comment/CommentPreviewPagerAdapter.java | 6 +- .../ui/commit/CommitFileListAdapter.java | 28 ++--- .../ui/commit/CommitListAdapter.java | 13 +- .../ui/commit/CommitPagerAdapter.java | 9 +- .../ui/gist/GistFilesPagerAdapter.java | 10 +- .../pockethub/ui/gist/GistListAdapter.java | 21 ++-- .../ui/issue/DashboardIssueListAdapter.java | 28 +++-- .../pockethub/ui/issue/FilterListAdapter.java | 15 +-- .../pockethub/ui/issue/IssueListAdapter.java | 10 +- .../ui/issue/IssuesPagerAdapter.java | 41 +++--- .../ui/issue/RepositoryIssueListAdapter.java | 21 ++-- .../ui/issue/SearchIssueListAdapter.java | 34 +++-- .../pockethub/ui/ref/CodeTreeAdapter.java | 65 +++++----- .../ui/repo/ContributorListAdapter.java | 9 +- .../ui/repo/DefaultRepositoryListAdapter.java | 36 +++--- .../ui/repo/UserRepositoryListAdapter.java | 28 ++--- .../search/SearchRepositoryListAdapter.java | 19 +-- .../ui/search/SearchUserListAdapter.java | 11 +- .../pockethub/ui/user/HomePagerAdapter.java | 4 +- .../pockethub/ui/user/NewsListAdapter.java | 118 +++++++++++++++--- .../pockethub/ui/user/UserListAdapter.java | 6 +- 23 files changed, 350 insertions(+), 254 deletions(-) diff --git a/app/src/main/java/com/github/pockethub/ui/NavigationDrawerAdapter.java b/app/src/main/java/com/github/pockethub/ui/NavigationDrawerAdapter.java index 974572869..1e714f856 100644 --- a/app/src/main/java/com/github/pockethub/ui/NavigationDrawerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/NavigationDrawerAdapter.java @@ -13,23 +13,23 @@ import android.widget.ImageView; import android.widget.TextView; +import com.alorma.github.sdk.bean.dto.response.Organization; +import com.alorma.github.sdk.bean.dto.response.User; import com.github.pockethub.R; import com.github.pockethub.util.AvatarLoader; import java.util.ArrayList; import java.util.List; -import org.eclipse.egit.github.core.User; - public class NavigationDrawerAdapter extends BaseAdapter { private final Context context; private final AvatarLoader avatars; private final LayoutInflater inflater; - private List orgs = new ArrayList<>(); + private List orgs = new ArrayList<>(); private List data; - public NavigationDrawerAdapter(Context context, List orgs, final AvatarLoader avatars) { + public NavigationDrawerAdapter(Context context, List orgs, final AvatarLoader avatars) { this.orgs.addAll(orgs); this.context = context; this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -52,12 +52,12 @@ else if (i == names.length) else if (i == names.length + 1) data.add(new NavigationDrawerObject("Organizations", TYPE_SUBHEADER)); else - data.add(new NavigationDrawerObject(orgs.get(i - names.length - 2).getLogin(), TYPE_ITEM_ORG, + data.add(new NavigationDrawerObject(orgs.get(i - names.length - 2).login, TYPE_ITEM_ORG, orgs.get(i - names.length - 2))); } } - public void setOrgs(List orgs) { + public void setOrgs(List orgs) { this.orgs.addAll(orgs); this.orgs.remove(0); notifyDataSetChanged(); diff --git a/app/src/main/java/com/github/pockethub/ui/comment/CommentListAdapter.java b/app/src/main/java/com/github/pockethub/ui/comment/CommentListAdapter.java index 79cada42b..9afecb363 100644 --- a/app/src/main/java/com/github/pockethub/ui/comment/CommentListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/CommentListAdapter.java @@ -16,15 +16,27 @@ package com.github.pockethub.ui.comment; import android.content.Context; +import android.support.v4.text.TextUtilsCompat; import android.support.v7.widget.PopupMenu; import android.text.Html; +import android.text.TextUtils; import android.text.method.LinkMovementMethod; +import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; +import android.view.TextureView; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; +import com.alorma.github.sdk.bean.dto.response.GithubComment; +import com.alorma.github.sdk.bean.dto.response.GithubEvent; +import com.alorma.github.sdk.bean.dto.response.Issue; +import com.alorma.github.sdk.bean.issue.IssueEvent; +import com.alorma.github.sdk.bean.issue.IssueStory; +import com.alorma.github.sdk.bean.issue.IssueStoryComment; +import com.alorma.github.sdk.bean.issue.IssueStoryDetail; +import com.alorma.github.sdk.bean.issue.IssueStoryEvent; import com.github.kevinsawicki.wishlist.MultiTypeAdapter; import com.github.pockethub.R; import com.github.pockethub.util.AvatarLoader; @@ -34,12 +46,8 @@ import java.util.Collection; -import org.eclipse.egit.github.core.Comment; -import org.eclipse.egit.github.core.Issue; -import org.eclipse.egit.github.core.IssueEvent; - /** - * Adapter for a list of {@link Comment} objects + * Adapter for a list of {@link GithubComment} objects */ public class CommentListAdapter extends MultiTypeAdapter { @@ -73,7 +81,7 @@ public class CommentListAdapter extends MultiTypeAdapter { * @param avatars * @param imageGetter */ - public CommentListAdapter(LayoutInflater inflater, Comment[] elements, + public CommentListAdapter(LayoutInflater inflater, GithubComment[] elements, AvatarLoader avatars, HttpImageGetter imageGetter, Issue issue) { this(inflater, elements, avatars, imageGetter, null, null, null, false, issue); this.context = inflater.getContext(); @@ -102,7 +110,7 @@ public CommentListAdapter(LayoutInflater inflater, AvatarLoader avatars, * @param userName * @param isOwner */ - public CommentListAdapter(LayoutInflater inflater, Comment[] elements, + public CommentListAdapter(LayoutInflater inflater, GithubComment[] elements, AvatarLoader avatars, HttpImageGetter imageGetter, EditCommentListener editCommentListener, DeleteCommentListener deleteCommentListener, String userName, boolean isOwner, Issue issue) { @@ -122,17 +130,17 @@ public CommentListAdapter(LayoutInflater inflater, Comment[] elements, @Override protected void update(int position, Object obj, int type) { if(type == 0) - updateComment((Comment) obj); + updateComment((GithubComment) obj); else updateEvent((IssueEvent) obj); } protected void updateEvent(final IssueEvent event) { TypefaceUtils.setOcticons(textView(0)); - String message = String.format("%s %s", event.getActor().getLogin(), event.getEvent()); - avatars.bind(imageView(2), event.getActor()); + String message = String.format("%s %s", event.actor.login, event.event); + avatars.bind(imageView(2), event.actor); - String eventString = event.getEvent(); + String eventString = event.event; switch (eventString) { case "assigned": @@ -174,8 +182,8 @@ protected void updateEvent(final IssueEvent event) { context.getResources().getColor(R.color.text_description)); break; case "merged": - message += String.format(" commit %s into %s from %s", event.getCommitId().substring(0,6), issue.getPullRequest().getBase().getRef(), - issue.getPullRequest().getHead().getRef()); + message += String.format(" commit %s into %s from %s", event.commit_id.substring(0, 6), issue.pullRequest.base.ref, + issue.pullRequest.head.ref); setText(0, TypefaceUtils.ICON_MERGE); textView(0).setTextColor( context.getResources().getColor(R.color.issue_event_merged)); @@ -192,21 +200,21 @@ protected void updateEvent(final IssueEvent event) { break; } - message += " " + TimeUtils.getRelativeTime(event.getCreatedAt()); + message += " " + TimeUtils.getRelativeTime(event.created_at); setText(1, Html.fromHtml(message)); } - protected void updateComment(final Comment comment) { - imageGetter.bind(textView(0), comment.getBodyHtml(), comment.getId()); - avatars.bind(imageView(3), comment.getUser()); + protected void updateComment(final GithubComment comment) { + imageGetter.bind(textView(0), comment.body, comment.id); + avatars.bind(imageView(3), comment.user); - setText(1, comment.getUser().getLogin()); - setText(2, TimeUtils.getRelativeTime(comment.getUpdatedAt())); + setText(1, comment.user.login); + setText(2, TimeUtils.getRelativeTime(comment.updated_at)); - final boolean canEdit = (isOwner || comment.getUser().getLogin().equals(userName)) + final boolean canEdit = (isOwner || comment.user.login.equals(userName)) && editCommentListener != null; - final boolean canDelete = (isOwner || comment.getUser().getLogin().equals(userName)) + final boolean canDelete = (isOwner || comment.user.login.equals(userName)) && deleteCommentListener != null; final ImageView ivMore = view(4); @@ -222,7 +230,7 @@ public void onClick(View v) { }); } - private void showMorePopup(View v, final Comment comment, final boolean canEdit, final boolean canDelete ) { + private void showMorePopup(View v, final GithubComment comment, final boolean canEdit, final boolean canDelete ) { PopupMenu menu = new PopupMenu(context, v); menu.inflate(R.menu.comment_popup); @@ -264,10 +272,14 @@ public MultiTypeAdapter setItems(final Object[] items) { this.clear(); for (Object item : items) { - if(item instanceof Comment) + if(item instanceof GithubComment) this.addItem(0, item); - else + else if(item instanceof GithubEvent) this.addItem(1, item); + else if(item instanceof IssueStoryComment) + this.addItem(0, ((IssueStoryComment) item).comment); + else if(item instanceof IssueStoryEvent) + this.addItem(1, ((IssueStoryEvent) item).event); } notifyDataSetChanged(); diff --git a/app/src/main/java/com/github/pockethub/ui/comment/CommentPreviewPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/comment/CommentPreviewPagerAdapter.java index 91b195ee5..b9f79f83f 100644 --- a/app/src/main/java/com/github/pockethub/ui/comment/CommentPreviewPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/comment/CommentPreviewPagerAdapter.java @@ -22,14 +22,14 @@ import com.github.pockethub.R; import com.github.pockethub.ui.FragmentPagerAdapter; -import org.eclipse.egit.github.core.IRepositoryIdProvider; +import com.alorma.github.sdk.bean.dto.response.Repo; /** * Pager of a raw and rendered comment text */ public class CommentPreviewPagerAdapter extends FragmentPagerAdapter { - private final IRepositoryIdProvider repo; + private final Repo repo; private RawCommentFragment textFragment; @@ -47,7 +47,7 @@ public class CommentPreviewPagerAdapter extends FragmentPagerAdapter { * @param repo */ public CommentPreviewPagerAdapter(ActionBarActivity activity, - IRepositoryIdProvider repo) { + Repo repo) { super(activity); this.context = activity.getApplicationContext(); this.repo = repo; diff --git a/app/src/main/java/com/github/pockethub/ui/commit/CommitFileListAdapter.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitFileListAdapter.java index d8382a8e7..4742d60da 100644 --- a/app/src/main/java/com/github/pockethub/ui/commit/CommitFileListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitFileListAdapter.java @@ -20,6 +20,8 @@ import android.text.TextUtils; import android.view.LayoutInflater; +import com.alorma.github.sdk.bean.dto.response.CommitComment; +import com.alorma.github.sdk.bean.dto.response.CommitFile; import com.github.kevinsawicki.wishlist.MultiTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.pockethub.R; @@ -31,8 +33,6 @@ import java.util.List; -import org.eclipse.egit.github.core.CommitComment; -import org.eclipse.egit.github.core.CommitFile; /** * Adapter to display a list of files changed in commits @@ -86,14 +86,14 @@ public int getViewTypeCount() { public long getItemId(int position) { switch (getItemViewType(position)) { case TYPE_FILE_HEADER: - String sha = ((CommitFile) getItem(position)).getSha(); + String sha = ((CommitFile) getItem(position)).sha; if (!TextUtils.isEmpty(sha)) return sha.hashCode(); else return super.getItemId(position); case TYPE_COMMENT: case TYPE_LINE_COMMENT: - return ((CommitComment) getItem(position)).getId(); + return Long.parseLong(((CommitComment) getItem(position)).id); default: return super.getItemId(position); } @@ -107,7 +107,7 @@ public long getItemId(int position) { */ public void addItem(final FullCommitFile file) { addItem(TYPE_FILE_HEADER, file.getFile()); - List lines = diffStyler.get(file.getFile().getFilename()); + List lines = diffStyler.get(file.getFile().filename); int number = 0; for (CharSequence line : lines) { addItem(TYPE_FILE_LINE, line); @@ -124,7 +124,7 @@ public void addItem(final FullCommitFile file) { */ public void addItem(final CommitFile file) { addItem(TYPE_FILE_HEADER, file); - addItems(TYPE_FILE_LINE, diffStyler.get(file.getFilename())); + addItems(TYPE_FILE_LINE, diffStyler.get(file.filename)); } /** @@ -173,7 +173,7 @@ protected void update(final int position, final Object item, final int type) { switch (type) { case TYPE_FILE_HEADER: CommitFile file = (CommitFile) item; - String path = file.getFilename(); + String path = file.filename; int lastSlash = path.lastIndexOf('/'); if (lastSlash != -1) { setText(0, path.substring(lastSlash + 1)); @@ -186,11 +186,11 @@ protected void update(final int position, final Object item, final int type) { StyledText stats = new StyledText(); stats.foreground('+', addTextColor); - stats.foreground(FORMAT_INT.format(file.getAdditions()), + stats.foreground(FORMAT_INT.format(file.additions), addTextColor); stats.append(' ').append(' ').append(' '); stats.foreground('-', removeTextColor); - stats.foreground(FORMAT_INT.format(file.getDeletions()), + stats.foreground(FORMAT_INT.format(file.deletions), removeTextColor); setText(2, stats); return; @@ -201,11 +201,11 @@ protected void update(final int position, final Object item, final int type) { case TYPE_LINE_COMMENT: case TYPE_COMMENT: CommitComment comment = (CommitComment) item; - avatars.bind(imageView(1), comment.getUser()); - setText(2, comment.getUser().getLogin()); - setText(3, TimeUtils.getRelativeTime(comment.getUpdatedAt())); - imageGetter.bind(textView(0), comment.getBodyHtml(), - comment.getId()); + avatars.bind(imageView(1), comment.user); + setText(2, comment.user.login); + setText(3, TimeUtils.getRelativeTime(comment.updated_at)); + imageGetter.bind(textView(0), comment.body_html, + comment.id); } } } diff --git a/app/src/main/java/com/github/pockethub/ui/commit/CommitListAdapter.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitListAdapter.java index 53dfc6bf1..1d71c9a40 100644 --- a/app/src/main/java/com/github/pockethub/ui/commit/CommitListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitListAdapter.java @@ -20,6 +20,7 @@ import android.view.View; import android.widget.TextView; +import com.alorma.github.sdk.bean.dto.response.Commit; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.pockethub.R; import com.github.pockethub.core.commit.CommitUtils; @@ -34,7 +35,7 @@ /** * Adapter to display commits */ -public class CommitListAdapter extends SingleTypeAdapter { +public class CommitListAdapter extends SingleTypeAdapter { private final AvatarLoader avatars; @@ -45,7 +46,7 @@ public class CommitListAdapter extends SingleTypeAdapter { * @param avatars */ public CommitListAdapter(int viewId, LayoutInflater inflater, - Collection elements, AvatarLoader avatars) { + Collection elements, AvatarLoader avatars) { super(inflater, viewId); this.avatars = avatars; @@ -54,7 +55,7 @@ public CommitListAdapter(int viewId, LayoutInflater inflater, @Override public long getItemId(int position) { - String sha = getItem(position).getSha(); + String sha = getItem(position).sha; if (!TextUtils.isEmpty(sha)) return sha.hashCode(); else @@ -77,8 +78,8 @@ protected View initialize(View view) { } @Override - protected void update(int position, RepositoryCommit item) { - setText(0, CommitUtils.abbreviate(item.getSha())); + protected void update(int position, Commit item) { + setText(0, CommitUtils.abbreviate(item.sha)); StyledText authorText = new StyledText(); authorText.bold(CommitUtils.getAuthor(item)); @@ -87,7 +88,7 @@ protected void update(int position, RepositoryCommit item) { setText(1, authorText); CommitUtils.bindAuthor(item, avatars, imageView(2)); - setText(3, item.getCommit().getMessage()); + setText(3, item.commit.message); setText(4, CommitUtils.getCommentCount(item)); } } diff --git a/app/src/main/java/com/github/pockethub/ui/commit/CommitPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/commit/CommitPagerAdapter.java index 6ad6f96df..bfa59c8c0 100644 --- a/app/src/main/java/com/github/pockethub/ui/commit/CommitPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/commit/CommitPagerAdapter.java @@ -21,16 +21,17 @@ import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; +import com.alorma.github.sdk.bean.dto.response.Repo; import com.github.pockethub.ui.FragmentStatePagerAdapter; -import org.eclipse.egit.github.core.Repository; +import com.alorma.github.sdk.bean.dto.response.Repo; /** * Pager over commits */ public class CommitPagerAdapter extends FragmentStatePagerAdapter { - private final Repository repository; + private final Repo repository; private final CharSequence[] ids; @@ -40,7 +41,7 @@ public class CommitPagerAdapter extends FragmentStatePagerAdapter { * @param ids */ public CommitPagerAdapter(ActionBarActivity activity, - Repository repository, CharSequence[] ids) { + Repo repository, CharSequence[] ids) { super(activity); this.repository = repository; @@ -51,7 +52,7 @@ public CommitPagerAdapter(ActionBarActivity activity, public Fragment getItem(final int position) { Bundle arguments = new Bundle(); arguments.putString(EXTRA_BASE, ids[position].toString()); - arguments.putSerializable(EXTRA_REPOSITORY, repository); + arguments.putParcelable(EXTRA_REPOSITORY, repository); CommitDiffListFragment fragment = new CommitDiffListFragment(); fragment.setArguments(arguments); return fragment; diff --git a/app/src/main/java/com/github/pockethub/ui/gist/GistFilesPagerAdapter.java b/app/src/main/java/com/github/pockethub/ui/gist/GistFilesPagerAdapter.java index db3e3aeee..26a8e764c 100644 --- a/app/src/main/java/com/github/pockethub/ui/gist/GistFilesPagerAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistFilesPagerAdapter.java @@ -20,12 +20,12 @@ import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; +import com.alorma.github.sdk.bean.dto.response.GistFile; import com.github.pockethub.ui.FragmentPagerAdapter; import java.util.Map; -import org.eclipse.egit.github.core.Gist; -import org.eclipse.egit.github.core.GistFile; +import com.alorma.github.sdk.bean.dto.response.Gist; /** * Pager adapter for all the files in a given gist @@ -41,7 +41,7 @@ public class GistFilesPagerAdapter extends FragmentPagerAdapter { public GistFilesPagerAdapter(ActionBarActivity activity, Gist gist) { super(activity); - Map gistFiles = gist.getFiles(); + Map gistFiles = gist.files; if (gistFiles != null && !gistFiles.isEmpty()) files = gistFiles.values().toArray(new GistFile[gistFiles.size()]); else @@ -50,7 +50,7 @@ public GistFilesPagerAdapter(ActionBarActivity activity, Gist gist) { @Override public CharSequence getPageTitle(int position) { - return files[position].getFilename(); + return files[position].filename; } @Override @@ -58,7 +58,7 @@ public Fragment getItem(final int position) { GistFile file = files[position]; Fragment fragment = new GistFileFragment(); Bundle args = new Bundle(); - args.putSerializable(EXTRA_GIST_FILE, file); + args.putParcelable(EXTRA_GIST_FILE, file); fragment.setArguments(args); return fragment; } diff --git a/app/src/main/java/com/github/pockethub/ui/gist/GistListAdapter.java b/app/src/main/java/com/github/pockethub/ui/gist/GistListAdapter.java index c31b3c112..5a2843e9e 100644 --- a/app/src/main/java/com/github/pockethub/ui/gist/GistListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/gist/GistListAdapter.java @@ -24,12 +24,13 @@ import com.github.pockethub.R; import com.github.pockethub.ui.StyledText; import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TimeUtils; import com.github.pockethub.util.TypefaceUtils; import java.util.Collection; -import org.eclipse.egit.github.core.Gist; -import org.eclipse.egit.github.core.User; +import com.alorma.github.sdk.bean.dto.response.Gist; +import com.alorma.github.sdk.bean.dto.response.User; /** * Adapter to display a list of {@link Gist} objects @@ -55,7 +56,7 @@ public GistListAdapter(AvatarLoader avatars, Activity activity, @Override public long getItemId(final int position) { - final String id = getItem(position).getId(); + final String id = getItem(position).id; return !TextUtils.isEmpty(id) ? id.hashCode() : super .getItemId(position); } @@ -79,27 +80,27 @@ protected View initialize(View view) { @Override protected void update(int position, Gist gist) { - setText(0, gist.getId()); + setText(0, gist.id); - String description = gist.getDescription(); + String description = gist.description; if (!TextUtils.isEmpty(description)) setText(1, description); else setText(1, R.string.no_description_given); - User user = gist.getUser(); + User user = gist.owner; avatars.bind(imageView(5), user); StyledText authorText = new StyledText(); if (user != null) - authorText.bold(user.getLogin()); + authorText.bold(user.login); else authorText.bold(anonymous); authorText.append(' '); - authorText.append(gist.getCreatedAt()); + authorText.append(TimeUtils.stringToDate(gist.created_at)); setText(2, authorText); - setNumber(3, gist.getComments()); - setNumber(4, gist.getFiles().size()); + setNumber(3, gist.comments); + setNumber(4, gist.files.size()); } } diff --git a/app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueListAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueListAdapter.java index 930510b74..4ea565442 100644 --- a/app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/DashboardIssueListAdapter.java @@ -19,9 +19,11 @@ import android.view.View; import android.widget.TextView; +import com.alorma.github.sdk.bean.dto.response.Issue; import com.github.pockethub.R; import com.github.pockethub.core.issue.IssueUtils; import com.github.pockethub.util.AvatarLoader; +import com.github.pockethub.util.TimeUtils; import com.github.pockethub.util.TypefaceUtils; import org.eclipse.egit.github.core.RepositoryIssue; @@ -30,7 +32,7 @@ * Adapter to display a list of dashboard issues */ public class DashboardIssueListAdapter extends - IssueListAdapter { + IssueListAdapter { private int numberPaintFlags; @@ -42,18 +44,18 @@ public class DashboardIssueListAdapter extends * @param elements */ public DashboardIssueListAdapter(AvatarLoader avatars, - LayoutInflater inflater, RepositoryIssue[] elements) { + LayoutInflater inflater, Issue[] elements) { super(R.layout.dashboard_issue_item, inflater, elements, avatars); } @Override public long getItemId(final int position) { - return getItem(position).getId(); + return Long.parseLong(getItem(position).id); } @Override - protected int getNumber(final RepositoryIssue issue) { - return issue.getNumber(); + protected int getNumber(final Issue issue) { + return issue.number; } @Override @@ -76,12 +78,12 @@ protected int[] getChildViewIds() { } @Override - protected void update(int position, RepositoryIssue issue) { - updateNumber(issue.getNumber(), issue.getState(), numberPaintFlags, 1); + protected void update(int position, Issue issue) { + updateNumber(issue.number, issue.state, numberPaintFlags, 1); - avatars.bind(imageView(3), issue.getUser()); + avatars.bind(imageView(3), issue.user); - String[] segments = issue.getUrl().split("/"); + String[] segments = issue.url.split("/"); int length = segments.length; if (length >= 4) setText(0, segments[length - 4] + '/' + segments[length - 3]); @@ -90,10 +92,10 @@ protected void update(int position, RepositoryIssue issue) { setGone(6, !IssueUtils.isPullRequest(issue)); - setText(2, issue.getTitle()); + setText(2, issue.title); - updateReporter(issue.getUser().getLogin(), issue.getCreatedAt(), 4); - setNumber(5, issue.getComments()); - updateLabels(issue.getLabels(), 7); + updateReporter(issue.user.login, TimeUtils.stringToDate(issue.created_at), 4); + setNumber(5, issue.comments); + updateLabels(issue.labels, 7); } } diff --git a/app/src/main/java/com/github/pockethub/ui/issue/FilterListAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/FilterListAdapter.java index e5ff9d6c7..7043e5918 100644 --- a/app/src/main/java/com/github/pockethub/ui/issue/FilterListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/FilterListAdapter.java @@ -18,6 +18,8 @@ import android.view.LayoutInflater; import android.widget.TextView; +import com.alorma.github.sdk.bean.dto.response.Label; +import com.alorma.github.sdk.bean.dto.response.Milestone; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.pockethub.R; @@ -26,9 +28,8 @@ import java.util.Collection; -import org.eclipse.egit.github.core.Label; -import org.eclipse.egit.github.core.Milestone; -import org.eclipse.egit.github.core.User; +import com.alorma.github.sdk.bean.dto.response.User; +import com.github.pockethub.util.InfoUtils; /** * Adapter to display a list of {@link IssueFilter} objects @@ -61,8 +62,8 @@ protected int[] getChildViewIds() { @Override protected void update(int position, IssueFilter filter) { - avatars.bind(imageView(0), filter.getRepository().getOwner()); - setText(1, filter.getRepository().generateId()); + avatars.bind(imageView(0), filter.getRepository().owner); + setText(1, InfoUtils.createRepoId(filter.getRepository())); if (filter.isOpen()) setText(2, R.string.open_issues); else @@ -78,14 +79,14 @@ protected void update(int position, IssueFilter filter) { Milestone milestone = filter.getMilestone(); if (milestone != null) - ViewUtils.setGone(setText(4, milestone.getTitle()), false); + ViewUtils.setGone(setText(4, milestone.title), false); else setGone(4, true); User assignee = filter.getAssignee(); if (assignee != null) { avatars.bind(imageView(7), assignee); - ViewUtils.setGone(setText(6, assignee.getLogin()), false); + ViewUtils.setGone(setText(6, assignee.login), false); } else setGone(5, true); } diff --git a/app/src/main/java/com/github/pockethub/ui/issue/IssueListAdapter.java b/app/src/main/java/com/github/pockethub/ui/issue/IssueListAdapter.java index c8b766276..356a6c03a 100644 --- a/app/src/main/java/com/github/pockethub/ui/issue/IssueListAdapter.java +++ b/app/src/main/java/com/github/pockethub/ui/issue/IssueListAdapter.java @@ -23,6 +23,8 @@ import android.view.View; import android.widget.TextView; +import com.alorma.github.sdk.bean.dto.response.IssueState; +import com.alorma.github.sdk.bean.dto.response.Label; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.github.kevinsawicki.wishlist.ViewUtils; import com.github.pockethub.R; @@ -33,8 +35,6 @@ import java.util.Date; import java.util.List; -import org.eclipse.egit.github.core.Label; - /** * Base list adapter to display issues * @@ -112,11 +112,11 @@ public void setItems(final Object[] items) { * @param flags * @param viewIndex */ - protected void updateNumber(int number, String state, int flags, + protected void updateNumber(int number, IssueState state, int flags, int viewIndex) { TextView view = textView(viewIndex); view.setText(Integer.toString(number)); - if (STATE_CLOSED.equals(state)) + if (state.equals(IssueState.closed)) view.setPaintFlags(flags | STRIKE_THRU_TEXT_FLAG); else view.setPaintFlags(flags); @@ -149,7 +149,7 @@ protected void updateLabels(final List

- * This checks both the {@link RepositoryCommit} and the underlying + * This checks both the {@link Commit} and the underlying * {@link Commit} to retrieve a name * * @param commit * @return author name or null if missing */ - public static String getAuthor(final RepositoryCommit commit) { - User author = commit.getAuthor(); + public static String getAuthor(final Commit commit) { + User author = commit.author; if (author != null) - return author.getLogin(); + return author.login; - Commit rawCommit = commit.getCommit(); + GitCommit rawCommit = commit.commit; if (rawCommit == null) return null; - CommitUser commitAuthor = rawCommit.getAuthor(); - return commitAuthor != null ? commitAuthor.getName() : null; + User commitAuthor = rawCommit.author; + return commitAuthor != null ? commitAuthor.login : null; } /** * Get committer of commit *

- * This checks both the {@link RepositoryCommit} and the underlying + * This checks both the {@link Commit} and the underlying * {@link Commit} to retrieve a name * * @param commit * @return committer name or null if missing */ - public static String getCommitter(final RepositoryCommit commit) { - User committer = commit.getCommitter(); + public static String getCommitter(final Commit commit) { + User committer = commit.committer; if (committer != null) - return committer.getLogin(); + return committer.login; - Commit rawCommit = commit.getCommit(); + GitCommit rawCommit = commit.commit; if (rawCommit == null) return null; - CommitUser commitCommitter = rawCommit.getCommitter(); - return commitCommitter != null ? commitCommitter.getName() : null; + User commitCommitter = rawCommit.committer; + return commitCommitter != null ? commitCommitter.login : null; } /** @@ -137,13 +136,13 @@ public static String getCommitter(final RepositoryCommit commit) { * @param commit * @return author name or null if missing */ - public static Date getAuthorDate(final RepositoryCommit commit) { - Commit rawCommit = commit.getCommit(); + public static Date getAuthorDate(final Commit commit) { + GitCommit rawCommit = commit.commit; if (rawCommit == null) return null; - CommitUser commitAuthor = rawCommit.getAuthor(); - return commitAuthor != null ? commitAuthor.getDate() : null; + User commitAuthor = rawCommit.author; + return commitAuthor != null && commitAuthor.date != null ? TimeUtils.stringToDate(commitAuthor.date) : null; } /** @@ -152,13 +151,13 @@ public static Date getAuthorDate(final RepositoryCommit commit) { * @param commit * @return author name or null if missing */ - public static Date getCommitterDate(final RepositoryCommit commit) { - Commit rawCommit = commit.getCommit(); + public static Date getCommitterDate(final Commit commit) { + GitCommit rawCommit = commit.commit; if (rawCommit == null) return null; - CommitUser commitCommitter = rawCommit.getCommitter(); - return commitCommitter != null ? commitCommitter.getDate() : null; + User commitCommitter = rawCommit.committer; + return commitCommitter != null && commitCommitter.date != null? TimeUtils.stringToDate(commitCommitter.date): null; } /** @@ -169,15 +168,15 @@ public static Date getCommitterDate(final RepositoryCommit commit) { * @param view * @return view */ - public static ImageView bindAuthor(final RepositoryCommit commit, + public static ImageView bindAuthor(final Commit commit, final AvatarLoader avatars, final ImageView view) { - User author = commit.getAuthor(); + User author = commit.author; if (author != null) avatars.bind(view, author); else { - Commit rawCommit = commit.getCommit(); + GitCommit rawCommit = commit.commit; if (rawCommit != null) - avatars.bind(view, rawCommit.getAuthor()); + avatars.bind(view, rawCommit.author); } return view; } @@ -190,15 +189,15 @@ public static ImageView bindAuthor(final RepositoryCommit commit, * @param view * @return view */ - public static ImageView bindCommitter(final RepositoryCommit commit, + public static ImageView bindCommitter(final Commit commit, final AvatarLoader avatars, final ImageView view) { - User committer = commit.getCommitter(); + User committer = commit.committer; if (committer != null) avatars.bind(view, committer); else { - Commit rawCommit = commit.getCommit(); + GitCommit rawCommit = commit.commit; if (rawCommit != null) - avatars.bind(view, rawCommit.getCommitter()); + avatars.bind(view, rawCommit.committer); } return view; } @@ -209,10 +208,10 @@ public static ImageView bindCommitter(final RepositoryCommit commit, * @param commit * @return count */ - public static String getCommentCount(final RepositoryCommit commit) { - final Commit rawCommit = commit.getCommit(); + public static String getCommentCount(final Commit commit) { + final GitCommit rawCommit = commit.commit; if (rawCommit != null) - return FORMAT.format(rawCommit.getCommentCount()); + return FORMAT.format(rawCommit.comment_count); else return "0"; } @@ -230,8 +229,8 @@ public static StyledText formatStats(final Collection files) { int changed = 0; if (files != null) for (CommitFile file : files) { - added += file.getAdditions(); - deleted += file.getDeletions(); + added += file.additions; + deleted += file.deletions; changed++; } @@ -262,7 +261,7 @@ public static StyledText formatStats(final Collection files) { * @return last segment of commit file path */ public static String getName(final CommitFile file) { - return file != null ? getName(file.getFilename()) : null; + return file != null ? getName(file.getFileName()) : null; } /** diff --git a/app/src/main/java/com/github/pockethub/core/issue/IssueUtils.java b/app/src/main/java/com/github/pockethub/core/issue/IssueUtils.java index d171cc461..562a48fd3 100644 --- a/app/src/main/java/com/github/pockethub/core/issue/IssueUtils.java +++ b/app/src/main/java/com/github/pockethub/core/issue/IssueUtils.java @@ -17,8 +17,9 @@ import android.text.TextUtils; -import org.eclipse.egit.github.core.Issue; -import org.eclipse.egit.github.core.PullRequest; +import com.alorma.github.sdk.PullRequest; +import com.alorma.github.sdk.bean.dto.response.Issue; + /** * Utilities for working with {@link Issue} models @@ -32,8 +33,8 @@ public class IssueUtils { * @return true if pull request, false otherwise */ public static boolean isPullRequest(final Issue issue) { - return issue != null && issue.getPullRequest() != null - && !TextUtils.isEmpty(issue.getPullRequest().getHtmlUrl()); + return issue != null && issue.pullRequest != null + && !TextUtils.isEmpty(issue.pullRequest.html_url); } /** @@ -47,23 +48,23 @@ public static Issue toIssue(final PullRequest pullRequest) { return null; Issue issue = new Issue(); - issue.setAssignee(pullRequest.getAssignee()); - issue.setBody(pullRequest.getBody()); - issue.setBodyHtml(pullRequest.getBodyHtml()); - issue.setBodyText(pullRequest.getBodyText()); - issue.setClosedAt(pullRequest.getClosedAt()); - issue.setComments(pullRequest.getComments()); - issue.setCreatedAt(pullRequest.getCreatedAt()); - issue.setHtmlUrl(pullRequest.getHtmlUrl()); - issue.setId(pullRequest.getId()); - issue.setMilestone(pullRequest.getMilestone()); - issue.setNumber(pullRequest.getNumber()); - issue.setPullRequest(pullRequest); - issue.setState(pullRequest.getState()); - issue.setTitle(pullRequest.getTitle()); - issue.setUpdatedAt(pullRequest.getUpdatedAt()); - issue.setUrl(pullRequest.getUrl()); - issue.setUser(pullRequest.getUser()); + issue.assignee = pullRequest.assignee; + issue.body = pullRequest.body; + issue.body_html = pullRequest.body_html; + issue.body = pullRequest.body; + issue.closedAt = pullRequest.closedAt; + issue.comments = pullRequest.comments; + issue.created_at = pullRequest.created_at; + issue.html_url = pullRequest.html_url; + issue.number = pullRequest.number; + issue.milestone = pullRequest.milestone; + issue.id = pullRequest.id; + issue.pullRequest = pullRequest; + issue.state = pullRequest.state; + issue.title = pullRequest.title; + issue.updated_at = pullRequest.updated_at; + issue.url = pullRequest.url; + issue.user = pullRequest.user; return issue; } } diff --git a/app/src/main/java/com/github/pockethub/core/ref/RefUtils.java b/app/src/main/java/com/github/pockethub/core/ref/RefUtils.java index 187118b7f..0adb5b39c 100644 --- a/app/src/main/java/com/github/pockethub/core/ref/RefUtils.java +++ b/app/src/main/java/com/github/pockethub/core/ref/RefUtils.java @@ -17,10 +17,11 @@ import android.text.TextUtils; -import org.eclipse.egit.github.core.Reference; +import com.alorma.github.sdk.bean.dto.response.GitReference; + /** - * Utilities for working with {@link Reference}s + * Utilities for working with {@link GitReference}s */ public class RefUtils { @@ -38,9 +39,9 @@ public class RefUtils { * @param ref * @return true if branch, false otherwise */ - public static boolean isBranch(final Reference ref) { + public static boolean isBranch(final GitReference ref) { if (ref != null) { - String name = ref.getRef(); + String name = ref.ref; return !TextUtils.isEmpty(name) && name.startsWith(PREFIX_HEADS); } else return false; @@ -52,8 +53,8 @@ public static boolean isBranch(final Reference ref) { * @param ref * @return true if tag, false otherwise */ - public static boolean isTag(final Reference ref) { - return ref != null && isTag(ref.getRef()); + public static boolean isTag(final GitReference ref) { + return ref != null && isTag(ref.ref); } /** @@ -72,10 +73,10 @@ public static boolean isTag(final String name) { * @param ref * @return full path */ - public static String getPath(final Reference ref) { + public static String getPath(final GitReference ref) { if (ref == null) return null; - String name = ref.getRef(); + String name = ref.ref; if (!TextUtils.isEmpty(name) && name.startsWith(PREFIX_REFS)) return name.substring(PREFIX_REFS.length()); else @@ -88,9 +89,9 @@ public static String getPath(final Reference ref) { * @param ref * @return short name */ - public static String getName(final Reference ref) { + public static String getName(final GitReference ref) { if (ref != null) - return getName(ref.getRef()); + return getName(ref.ref); else return null; } @@ -122,11 +123,11 @@ else if (name.startsWith(PREFIX_REFS)) * @param ref * @return true if valid, false otherwise */ - public static boolean isValid(final Reference ref) { + public static boolean isValid(final GitReference ref) { if (ref == null) return false; - String name = ref.getRef(); + String name = ref.ref; return !TextUtils.isEmpty(name) && !name.startsWith(PREFIX_PULL); } } diff --git a/app/src/main/java/com/github/pockethub/core/repo/RepositoryUtils.java b/app/src/main/java/com/github/pockethub/core/repo/RepositoryUtils.java index 62577ad81..4d1dadfb0 100644 --- a/app/src/main/java/com/github/pockethub/core/repo/RepositoryUtils.java +++ b/app/src/main/java/com/github/pockethub/core/repo/RepositoryUtils.java @@ -17,10 +17,12 @@ import android.text.TextUtils; -import org.eclipse.egit.github.core.Repository; +import com.alorma.github.sdk.bean.dto.response.Repo; + +import com.alorma.github.sdk.bean.dto.response.Repo; /** - * Utilities for working with {@link Repository} objects + * Utilities for working with {@link Repo} objects */ public class RepositoryUtils { @@ -35,10 +37,10 @@ public class RepositoryUtils { * @return true if complete, false otherwise * */ - public static boolean isComplete(final Repository repository) { - return repository.isPrivate() || repository.isFork() - || repository.getForks() > 0 || repository.getWatchers() > 0 - || repository.isHasIssues(); + public static boolean isComplete(final Repo repository) { + return repository.isPrivate || repository.fork + || repository.forks_count > 0 || repository.watchers_count > 0 + || repository.has_issues; } /** From 154cfb4912df4d41ade49ca11a56a5139c5395c9 Mon Sep 17 00:00:00 2001 From: Henrik Date: Wed, 23 Sep 2015 16:41:40 +0200 Subject: [PATCH 0588/1055] IssueFilter updated to use new SDK --- .../pockethub/core/issue/IssueFilter.java | 92 +++++++++++++------ 1 file changed, 65 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/github/pockethub/core/issue/IssueFilter.java b/app/src/main/java/com/github/pockethub/core/issue/IssueFilter.java index 7541e1ef4..5ed161373 100644 --- a/app/src/main/java/com/github/pockethub/core/issue/IssueFilter.java +++ b/app/src/main/java/com/github/pockethub/core/issue/IssueFilter.java @@ -15,6 +15,9 @@ */ package com.github.pockethub.core.issue; +import android.os.Parcel; +import android.os.Parcelable; + import static java.lang.String.CASE_INSENSITIVE_ORDER; import static org.eclipse.egit.github.core.service.IssueService.DIRECTION_DESCENDING; import static org.eclipse.egit.github.core.service.IssueService.FIELD_DIRECTION; @@ -38,22 +41,22 @@ import java.util.Set; import java.util.TreeSet; -import org.eclipse.egit.github.core.Label; -import org.eclipse.egit.github.core.Milestone; -import org.eclipse.egit.github.core.Repository; -import org.eclipse.egit.github.core.User; +import com.alorma.github.sdk.bean.dto.response.Label; +import com.alorma.github.sdk.bean.dto.response.Milestone; +import com.alorma.github.sdk.bean.dto.response.Repo; +import com.alorma.github.sdk.bean.dto.response.User; /** * Issue filter containing at least one valid query */ -public class IssueFilter implements Serializable, Cloneable, Comparator