diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a4c894a92c43fe8362586d4320d486bfb9b601fb..bb1109f6dd67ddcd7614f35dc1e5d414d5926adb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,9 +10,6 @@ before_script: - export GRADLE_USER_HOME=$PWD/.gradle # Accept the license for the Android build tools - echo y | /opt/android-sdk/tools/bin/sdkmanager "build-tools;26.0.2" - # Install the Android support repository - # TODO: Remove this when we upgrade the support library - - echo y | /opt/android-sdk/tools/bin/sdkmanager 'extras;android;m2repository' # Download OpenJDK 6 so we can compile against its standard library - JDK_FILE=openjdk-6-jre-headless_6b38-1.13.10-1~deb7u1_amd64.deb - if [ ! -d openjdk ] diff --git a/bramble-android/build.gradle b/bramble-android/build.gradle index 9eae59ea0761f0c66bc506e716235f0ee0ca539d..b967b629c3ee4829de308f7389a8375ae27e6598 100644 --- a/bramble-android/build.gradle +++ b/bramble-android/build.gradle @@ -6,12 +6,12 @@ apply plugin: 'witness' apply plugin: 'de.undercouch.download' android { - compileSdkVersion 26 + compileSdkVersion 27 buildToolsVersion '26.0.2' defaultConfig { minSdkVersion 14 - targetSdkVersion 22 + targetSdkVersion 26 versionCode 1611 versionName "0.16.11" consumerProguardFiles 'proguard-rules.txt' @@ -90,6 +90,6 @@ def verifyBinary(name, chksum) { project.afterEvaluate { torBinaries.every { key, value -> - preBuild.dependsOn.add(verifyBinary(key, value)) + preBuild.dependsOn.add(verifyBinary(key, value)) } } diff --git a/briar-android/build.gradle b/briar-android/build.gradle index d2601109a2291ea85279e929e41c68a22ed4d00b..d17b7aff23eda435e2ff6cb681cc136183004c3b 100644 --- a/briar-android/build.gradle +++ b/briar-android/build.gradle @@ -6,7 +6,7 @@ dependencies { implementation project(path: ':bramble-core', configuration: 'default') implementation project(path: ':bramble-android', configuration: 'default') - def supportVersion = '23.2.1' + def supportVersion = '27.0.1' implementation "com.android.support:support-v4:$supportVersion" implementation("com.android.support:appcompat-v7:$supportVersion") { exclude module: 'support-v4' @@ -32,7 +32,7 @@ dependencies { implementation 'com.google.zxing:core:3.3.0' implementation 'com.jpardogo.materialtabstrip:library:1.1.0' implementation 'com.github.bumptech.glide:glide:3.8.0' - implementation 'uk.co.samuelwall:material-tap-target-prompt:1.9.2' + implementation 'uk.co.samuelwall:material-tap-target-prompt:2.1.0' annotationProcessor 'com.google.dagger:dagger-compiler:2.0.2' @@ -53,6 +53,9 @@ dependencies { dependencyVerification { verify = [ + 'android.arch.core:common:1.0.0:common-1.0.0.jar:5192934cd73df32e2c15722ed7fc488dde90baaec9ae030010dd1a80fb4e74e1', + 'android.arch.lifecycle:common:1.0.0:common-1.0.0.jar:86bf301a20ad0cd0a391e22a52e6fbf90575c096ff83233fa9fd0d52b3219121', + 'android.arch.lifecycle:runtime:1.0.0:runtime-1.0.0.aar:e4e34e5d02bd102e8d39ddbc29f9ead8a15a61e367993d02238196ac48509ad8', 'backport-util-concurrent:backport-util-concurrent:3.1:backport-util-concurrent-3.1.jar:f5759b7fcdfc83a525a036deedcbd32e5b536b625ebc282426f16ca137eb5902', 'cglib:cglib:3.2.0:cglib-3.2.0.jar:adb13bab79712ad6bdf1bd59f2a3918018a8016e722e8a357065afb9e6690861', 'ch.acra:acra:4.8.5:acra-4.8.5.aar:afd5b28934d5166b55f261c85685ad59e8a4ebe9ca1960906afaa8c76d8dc9eb', @@ -60,16 +63,22 @@ dependencyVerification { 'com.almworks.sqlite4java:sqlite4java:0.282:sqlite4java-0.282.jar:9e1d8dd83ca6003f841e3af878ce2dc7c22497493a7bb6d1b62ec1b0d0a83c05', 'com.android.support.constraint:constraint-layout-solver:1.0.2:constraint-layout-solver-1.0.2.jar:8c62525a9bc5cff5633a96cb9b32fffeccaf41b8841aa87fc22607070dea9b8d', 'com.android.support.constraint:constraint-layout:1.0.2:constraint-layout-1.0.2.aar:b0c688cc2b7172608f8153a689d746da40f71e52d7e2fe2bfd9df2f92db77085', - 'com.android.support:animated-vector-drawable:23.2.1:animated-vector-drawable-23.2.1.aar:06d1963b85aa917099d7757e6a7b3e4dc06889413dc747f625ae8683606db3a1', - 'com.android.support:appcompat-v7:23.2.1:appcompat-v7-23.2.1.aar:00f9d93acacd6731f309724054bf51492814b4b2869f16d7d5c0038dcb8c9a0d', - 'com.android.support:cardview-v7:23.2.1:cardview-v7-23.2.1.aar:4595f1c4a28cfa083b6c0920ad4d49e1c2ca4b8302a955e548f68eb63b74931b', - 'com.android.support:design:23.2.1:design-23.2.1.aar:003e0c0bea0a6891f8b2bc43f20ae7af2a49a17363e5bb10df5ee0bae12fa686', - 'com.android.support:preference-v14:23.2.1:preference-v14-23.2.1.aar:44881bb46094e86d0bc2426f205419674a5b4eb514b44b5a4659b5de29f71eb7', - 'com.android.support:preference-v7:23.2.1:preference-v7-23.2.1.aar:775101bd07bd052e455761c5c5d9523d7ad59f2f320e3e8cbde241fd6b1d6025', - 'com.android.support:recyclerview-v7:23.2.1:recyclerview-v7-23.2.1.aar:44040a888e23e0c93162a3377cfe06751080e3c22d369ab0d4301ef60d63b0fe', - 'com.android.support:support-annotations:23.4.0:support-annotations-23.4.0.jar:e91a88dd0c5e99069b7f09d4a46b5e06f1e9c4c72fc0a8e987e25d86af480f01', - 'com.android.support:support-v4:23.2.1:support-v4-23.2.1.aar:81ce890f26d35c75ad17d0f998a7e3230330c3b41e0b629566bc744bee89e448', - 'com.android.support:support-vector-drawable:23.2.1:support-vector-drawable-23.2.1.aar:799bafe4c3de812386f0b291f744d5d6876452722dd40189b9ab87dbbf594ea1', + 'com.android.support:animated-vector-drawable:27.0.1:animated-vector-drawable-27.0.1.aar:365050110411c86c7eec86101b49ab53557ffe6667f60b19055f1d35c38a577b', + 'com.android.support:appcompat-v7:27.0.1:appcompat-v7-27.0.1.aar:1402c29a49db30346c21a7d40634461765b3ab826f5dd95bc4dcc76787b21851', + 'com.android.support:cardview-v7:27.0.1:cardview-v7-27.0.1.aar:43fccd44086c51eaa9d78be2fcf0dfea1556c8876a6fd325ea8d24e860054202', + 'com.android.support:design:27.0.1:design-27.0.1.aar:0e7c694bd5385e82d193e33b7289f769ce6ff05e277443daf5bffc3d852ef448', + 'com.android.support:preference-v14:27.0.1:preference-v14-27.0.1.aar:beed3ee97ae0d2541bd0adac6c84bb7d7b7580399f24e8efb9bc624161b164df', + 'com.android.support:preference-v7:27.0.1:preference-v7-27.0.1.aar:d87ba6ae7c834fd68ef09cbc0f064975627ba14189dbef639c34080691366da9', + 'com.android.support:recyclerview-v7:27.0.1:recyclerview-v7-27.0.1.aar:99ae2863287df800f239617d09cafc58b95f7a5365db32e3761394fa01ab12c9', + 'com.android.support:support-annotations:27.0.1:support-annotations-27.0.1.jar:240912b779fe7413bdd97c94ac2a92d1fb29bd53c4d50c6982e5942b01278ac0', + 'com.android.support:support-compat:27.0.1:support-compat-27.0.1.aar:70dfd92561421e5ae113dfc4045fc94c90caca9912839b3d08c793aa391aedcc', + 'com.android.support:support-core-ui:27.0.1:support-core-ui-27.0.1.aar:91614f829f8a6f1fc2d28efc58ea2735212225ab02cdf768b3dd9af72371d5f0', + 'com.android.support:support-core-utils:27.0.1:support-core-utils-27.0.1.aar:b33c5a5d67b8bfa6c8829875661779279157bf23e6042179820eaf1745034a72', + 'com.android.support:support-fragment:27.0.1:support-fragment-27.0.1.aar:05a859783ae4a285c6d5c9865e1242b86f5bfb69a30455ca6c8495f24c09d9ed', + 'com.android.support:support-media-compat:27.0.1:support-media-compat-27.0.1.aar:bc1c0252c1d071a1676fd280a792cf0717833fb3afd0ef73070ddc51ef921ad7', + 'com.android.support:support-v4:27.0.1:support-v4-27.0.1.aar:afd802f1926475f40c5b6b42855c9a626a854298908dafdb455deb6dab2640f2', + 'com.android.support:support-vector-drawable:27.0.1:support-vector-drawable-27.0.1.aar:67154ea191f735496502214bc6da6195738829a8e9d59e8042a1e030a2c7f19c', + 'com.android.support:transition:27.0.1:transition-27.0.1.aar:8a46d152391bd1598d1778ae889b3aeaff77a17d0caaa29446df6e26a28c4e4b', 'com.github.bumptech.glide:glide:3.8.0:glide-3.8.0.jar:750d9e7b940dc0ee48f8680623b55d46e14e8727acc922d7b156e57e7c549655', 'com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1:accessibility-test-framework-2.1.jar:7b0aa6ed7553597ce0610684a9f7eca8021eee218f2e2f427c04a7fbf5f920bd', 'com.google.code.findbugs:jsr305:3.0.2:jsr305-3.0.2.jar:766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7', @@ -147,9 +156,10 @@ dependencyVerification { 'org.robolectric:sandbox:3.5.1:sandbox-3.5.1.jar:beff8c3c1e840e0f7f78aadef170f347bae349f098babfc176765f499a4bcbb5', 'org.robolectric:shadowapi:3.5.1:shadowapi-3.5.1.jar:6d574f9ae0922791eb8f06979f0010997d4b862c7aec96d485ae797ddfc13278', 'org.robolectric:shadows-framework:3.5.1:shadows-framework-3.5.1.jar:597b54cc1a494799d783921c6ac04352f33e94fca8e00f299d4ca192db79e3fc', + 'org.robolectric:shadows-support-v4:3.0:shadows-support-v4-3.0.jar:66bcc3257b037d72998e860d67b1bc58215b7eeac8ad860fcc3e613332d88619', 'org.robolectric:utils:3.5.1:utils-3.5.1.jar:d7d77326867e6d903156ebb18c244819b26aebe3aa82a1c57081081a0b6c4f63', 'org.slf4j:slf4j-api:1.7.16:slf4j-api-1.7.16.jar:e56288031f5e60652c06e7bb6e9fa410a61231ab54890f7b708fc6adc4107c5b', - 'uk.co.samuelwall:material-tap-target-prompt:1.9.2:material-tap-target-prompt-1.9.2.aar:5d4951124366bc5c52e57beaa294db7611f0aa2a8d80e0163e1383e1966ba5b2', + 'uk.co.samuelwall:material-tap-target-prompt:2.1.0:material-tap-target-prompt-2.1.0.aar:6df17e7c371f9264bfe440506f91205dd47566869c1528891943a04a26c96a94', 'xmlpull:xmlpull:1.1.3.1:xmlpull-1.1.3.1.jar:34e08ee62116071cbb69c0ed70d15a7a5b208d62798c59f2120bb8929324cb63', 'xpp3:xpp3_min:1.1.4c:xpp3_min-1.1.4c.jar:bfc90e9e32d0eab1f397fb974b5f150a815188382ac41f372a7149d5bc178008', ] @@ -169,12 +179,12 @@ def getGitHash = { -> } android { - compileSdkVersion 26 + compileSdkVersion 27 buildToolsVersion '26.0.2' defaultConfig { minSdkVersion 14 - targetSdkVersion 22 + targetSdkVersion 26 versionCode 1611 versionName "0.16.11" applicationId "org.briarproject.briar.beta" diff --git a/briar-android/src/main/java/org/briarproject/briar/android/StartupFailureActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/StartupFailureActivity.java index 51ee125d5319e7fd4e2e6aef08c4cd1919e47c85..dae9706d68f15c64253ac1012183ad4c3d9cb135 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/StartupFailureActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/StartupFailureActivity.java @@ -38,7 +38,7 @@ public class StartupFailureActivity extends BaseActivity { } // show proper error message - TextView view = (TextView) findViewById(R.id.errorView); + TextView view = findViewById(R.id.errorView); if (result.equals(StartResult.DB_ERROR)) { view.setText(getText(R.string.startup_failed_db_error)); } else if (result.equals(StartResult.SERVICE_ERROR)) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/activity/BriarActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/activity/BriarActivity.java index d00730f2448db7b361072965692d5a51ae09178d..3892521fe1a554c3cae7a1b7480e0b9b2594998e 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/activity/BriarActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/activity/BriarActivity.java @@ -100,7 +100,7 @@ public abstract class BriarActivity extends BaseActivity { @Nullable protected Toolbar setUpCustomToolbar(boolean ownLayout) { // Custom Toolbar - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); if (ab != null) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/BasePostFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/BasePostFragment.java index 7817c5a3ae05f3b3ca75f7e3a182d0667cedd2c8..3dd18e0be69ea91d23be7b6d5294a981fbbaaf0e 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/BasePostFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/BasePostFragment.java @@ -58,7 +58,7 @@ abstract class BasePostFragment extends BaseFragment { View view = inflater.inflate(R.layout.fragment_blog_post, container, false); - progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar = view.findViewById(R.id.progressBar); progressBar.setVisibility(VISIBLE); ui = new BlogPostViewHolder(view, true, new OnBlogPostClickListener() { @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogFragment.java index 7f6e36eda4787ef0a02a75b9856b9e46b6116080..765d83f2023e50f264de481c479ecfca0ed20f5a 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogFragment.java @@ -92,7 +92,7 @@ public class BlogFragment extends BaseFragment View v = inflater.inflate(R.layout.fragment_blog, container, false); adapter = new BlogPostAdapter(getActivity(), this); - list = (BriarRecyclerView) v.findViewById(R.id.postList); + list = v.findViewById(R.id.postList); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setAdapter(adapter); list.showProgressBar(); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogPostViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogPostViewHolder.java index 4e01c943f6e67d80bcaacd1f422cb94107160869..d013fbcb503feeab079353cc07bd7ed373bf5cc5 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogPostViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogPostViewHolder.java @@ -59,13 +59,12 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder { this.listener = listener; ctx = v.getContext(); - layout = (ViewGroup) v.findViewById(R.id.postLayout); - reblogger = (AuthorView) v.findViewById(R.id.rebloggerView); - author = (AuthorView) v.findViewById(R.id.authorView); - reblogButton = (ImageView) v.findViewById(R.id.commentView); - body = (TextView) v.findViewById(R.id.bodyView); - commentContainer = - (ViewGroup) v.findViewById(R.id.commentContainer); + layout = v.findViewById(R.id.postLayout); + reblogger = v.findViewById(R.id.rebloggerView); + author = v.findViewById(R.id.authorView); + reblogButton = v.findViewById(R.id.commentView); + body = v.findViewById(R.id.bodyView); + commentContainer = v.findViewById(R.id.commentContainer); } void setVisibility(int visibility) { @@ -135,7 +134,7 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder { ActivityOptionsCompat options = makeSceneTransitionAnimation((Activity) ctx, layout, getTransitionName(item.getId())); - ActivityCompat.startActivity((Activity) ctx, i, + ActivityCompat.startActivity(ctx, i, options.toBundle()); } else { // work-around for android bug #224270 @@ -173,8 +172,8 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder { .inflate(R.layout.list_item_blog_comment, commentContainer, false); - AuthorView author = (AuthorView) v.findViewById(R.id.authorView); - TextView body = (TextView) v.findViewById(R.id.bodyView); + AuthorView author = v.findViewById(R.id.authorView); + TextView body = v.findViewById(R.id.bodyView); author.setAuthor(c.getAuthor()); author.setAuthorStatus(c.getAuthorStatus()); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java index a884510a0ff8c9c9d5f40d3f5ea86c7c3fb6b62a..6f7f309903c849a436458c158c0ba7eef9923db9 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java @@ -77,7 +77,7 @@ public class FeedFragment extends BaseFragment implements adapter = new BlogPostAdapter(getActivity(), this); layoutManager = new LinearLayoutManager(getActivity()); - list = (BriarRecyclerView) v.findViewById(R.id.postList); + list = v.findViewById(R.id.postList); list.setLayoutManager(layoutManager); list.setAdapter(adapter); list.setEmptyText(R.string.blogs_feed_empty_state); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/ReblogFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/ReblogFragment.java index db6625bf7b5878ee361a98c017104c318e25b883..8bd99617d3506f9be1a0adb3ebb8e793a39c9b15 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/ReblogFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/ReblogFragment.java @@ -154,8 +154,8 @@ public class ReblogFragment extends BaseFragment implements TextInputListener { private final TextInputView input; private ViewHolder(View v) { - scrollView = (ScrollView) v.findViewById(R.id.scrollView); - progressBar = (ProgressBar) v.findViewById(R.id.progressBar); + scrollView = v.findViewById(R.id.scrollView); + progressBar = v.findViewById(R.id.progressBar); post = new BlogPostViewHolder(v.findViewById(R.id.postLayout), true, new OnBlogPostClickListener() { @Override @@ -168,7 +168,7 @@ public class ReblogFragment extends BaseFragment implements TextInputListener { // probably don't want to allow author clicks here } }); - input = (TextInputView) v.findViewById(R.id.inputText); + input = v.findViewById(R.id.inputText); } } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedAdapter.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedAdapter.java index 4318958cd4bece6f0896f1f11f87436db311975c..d51fdc4aa66f9599d73a9ae59e55e648a20c9c97 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedAdapter.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedAdapter.java @@ -104,13 +104,13 @@ class RssFeedAdapter extends BriarAdapter<Feed, RssFeedAdapter.FeedViewHolder> { super(v); layout = v; - title = (TextView) v.findViewById(R.id.titleView); - delete = (ImageButton) v.findViewById(R.id.deleteButton); - imported = (TextView) v.findViewById(R.id.importedView); - updated = (TextView) v.findViewById(R.id.updatedView); - author = (TextView) v.findViewById(R.id.authorView); - authorLabel = (TextView) v.findViewById(R.id.author); - description = (TextView) v.findViewById(R.id.descriptionView); + title = v.findViewById(R.id.titleView); + delete = v.findViewById(R.id.deleteButton); + imported = v.findViewById(R.id.importedView); + updated = v.findViewById(R.id.updatedView); + author = v.findViewById(R.id.authorView); + authorLabel = v.findViewById(R.id.author); + description = v.findViewById(R.id.descriptionView); } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedImportActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedImportActivity.java index 3629f9bef02809bfcf9ffc7cf104483bf1d752a9..dafea3054e097daf2e303509056b6adae8ddcca2 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedImportActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedImportActivity.java @@ -54,7 +54,7 @@ public class RssFeedImportActivity extends BriarActivity { setContentView(R.layout.activity_rss_feed_import); - urlInput = (EditText) findViewById(R.id.urlInput); + urlInput = findViewById(R.id.urlInput); urlInput.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, @@ -72,10 +72,10 @@ public class RssFeedImportActivity extends BriarActivity { } }); - importButton = (Button) findViewById(R.id.importButton); + importButton = findViewById(R.id.importButton); importButton.setOnClickListener(v -> publish()); - progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar = findViewById(R.id.progressBar); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedManageActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedManageActivity.java index 49dbc997d33a5931552c7212f49e08778fc9a84c..1220f39867976f916cc82ee2c64cd2c8fb98ea2e 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedManageActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/RssFeedManageActivity.java @@ -49,7 +49,7 @@ public class RssFeedManageActivity extends BriarActivity adapter = new RssFeedAdapter(this, this); - list = (BriarRecyclerView) findViewById(R.id.feedList); + list = findViewById(R.id.feedList); list.setLayoutManager(new LinearLayoutManager(this)); list.setAdapter(adapter); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/WriteBlogPostActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/WriteBlogPostActivity.java index 45ed94f948a6d623e8634189eeb65f521ac86cb4..918c6def21fbcda550b06f00e4792ca51bed482b 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/WriteBlogPostActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/WriteBlogPostActivity.java @@ -69,7 +69,7 @@ public class WriteBlogPostActivity extends BriarActivity setContentView(R.layout.activity_write_blog_post); - input = (TextInputView) findViewById(R.id.bodyInput); + input = findViewById(R.id.bodyInput); input.setSendButtonEnabled(false); input.addTextChangedListener(new TextWatcher() { @Override @@ -89,7 +89,7 @@ public class WriteBlogPostActivity extends BriarActivity }); input.setListener(this); - progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar = findViewById(R.id.progressBar); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactItemViewHolder.java index a21e9ae1b3a1ee89727f45b06712bd594ada9b73..6bc4f3d493e0b49159859c6289b35599b6d26a11 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactItemViewHolder.java @@ -31,10 +31,10 @@ public class ContactItemViewHolder<I extends ContactItem> super(v); layout = (ViewGroup) v; - avatar = (ImageView) v.findViewById(R.id.avatarView); - name = (TextView) v.findViewById(R.id.nameView); + avatar = v.findViewById(R.id.avatarView); + name = v.findViewById(R.id.nameView); // this can be null as not all layouts that use this ViewHolder have it - bulb = (ImageView) v.findViewById(R.id.bulbView); + bulb = v.findViewById(R.id.bulbView); } protected void bind(I item, @Nullable OnContactClickListener<I> listener) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java index 47826355fba0674ace514f842335b6de636e19a5..d404ea47a40b6894aa481838c1b8b8790a1c65cf 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java @@ -143,7 +143,7 @@ public class ContactListFragment extends BaseFragment implements EventListener { } }; adapter = new ContactListAdapter(getContext(), onContactClickListener); - list = (BriarRecyclerView) contentView.findViewById(R.id.list); + list = contentView.findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(getContext())); list.setAdapter(adapter); list.setEmptyText(getString(R.string.no_contacts)); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListItemViewHolder.java index 386b2590620ef8a648019525b926d9cd1c4e1037..337f6b7e96008f18ea3e7e9879a69583495b32d7 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListItemViewHolder.java @@ -24,8 +24,8 @@ class ContactListItemViewHolder extends ContactItemViewHolder<ContactListItem> { ContactListItemViewHolder(View v) { super(v); - unread = (TextView) v.findViewById(R.id.unreadCountView); - date = (TextView) v.findViewById(R.id.dateView); + unread = v.findViewById(R.id.unreadCountView); + date = v.findViewById(R.id.dateView); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java index d0ae82427af1938bb94d7528c7798dd3860937c6..585b0fed9be5a448482568b7b21e7e962dfc157b 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java @@ -14,7 +14,6 @@ import android.util.SparseArray; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import android.widget.TextView; @@ -100,7 +99,7 @@ import javax.inject.Inject; import de.hdodenhof.circleimageview.CircleImageView; import im.delight.android.identicons.IdenticonDrawable; import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt; -import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.OnHidePromptListener; +import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.PromptStateChangeListener; import static android.support.v4.view.ViewCompat.setTransitionName; import static android.support.v7.util.SortedList.INVALID_POSITION; @@ -112,6 +111,8 @@ import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_ import static org.briarproject.briar.android.util.UiUtils.getAvatarTransitionName; import static org.briarproject.briar.android.util.UiUtils.getBulbTransitionName; import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_BODY_LENGTH; +import static uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.STATE_DISMISSED; +import static uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.STATE_FINISHED; @MethodsNotNullByDefault @ParametersNotNullByDefault @@ -199,23 +200,21 @@ public class ConversationActivity extends BriarActivity // Custom Toolbar toolbar = setUpCustomToolbar(true); if (toolbar != null) { - toolbarAvatar = - (CircleImageView) toolbar.findViewById(R.id.contactAvatar); - toolbarStatus = - (ImageView) toolbar.findViewById(R.id.contactStatus); - toolbarTitle = (TextView) toolbar.findViewById(R.id.contactName); + toolbarAvatar = toolbar.findViewById(R.id.contactAvatar); + toolbarStatus = toolbar.findViewById(R.id.contactStatus); + toolbarTitle = toolbar.findViewById(R.id.contactName); } setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId)); setTransitionName(toolbarStatus, getBulbTransitionName(contactId)); adapter = new ConversationAdapter(this, this); - list = (BriarRecyclerView) findViewById(R.id.conversationView); + list = findViewById(R.id.conversationView); list.setLayoutManager(new LinearLayoutManager(this)); list.setAdapter(adapter); list.setEmptyText(getString(R.string.no_private_messages)); - textInputView = (TextInputView) findViewById(R.id.text_input_container); + textInputView = findViewById(R.id.text_input_container); textInputView.setListener(this); } @@ -393,7 +392,7 @@ public class ConversationActivity extends BriarActivity /** * Creates ConversationItems from headers loaded from the database. - * + * <p> * Attention: Call this only after contactName has been initialized. */ @SuppressWarnings("ConstantConditions") @@ -562,6 +561,7 @@ public class ConversationActivity extends BriarActivity addConversationItem(item); }); } + @Override public void onFailure(Throwable exception) { runOnUiThreadUnlessDestroyed( @@ -580,6 +580,7 @@ public class ConversationActivity extends BriarActivity addConversationItem(item); }); } + @Override public void onFailure(Throwable exception) { runOnUiThreadUnlessDestroyed( @@ -598,6 +599,7 @@ public class ConversationActivity extends BriarActivity addConversationItem(item); }); } + @Override public void onFailure(Throwable exception) { runOnUiThreadUnlessDestroyed( @@ -616,6 +618,7 @@ public class ConversationActivity extends BriarActivity addConversationItem(item); }); } + @Override public void onFailure(Throwable exception) { runOnUiThreadUnlessDestroyed( @@ -778,25 +781,25 @@ public class ConversationActivity extends BriarActivity return; } - OnHidePromptListener listener = new OnHidePromptListener() { - @Override - public void onHidePrompt(MotionEvent motionEvent, - boolean focalClicked) { - introductionOnboardingSeen(); - } + PromptStateChangeListener listener = new PromptStateChangeListener() { + @Override + public void onPromptStateChanged( + MaterialTapTargetPrompt prompt, int state) { + if (state == STATE_DISMISSED || + state == STATE_FINISHED) { +introductionOnboardingSeen(); + } + } + + }; + new MaterialTapTargetPrompt.Builder(ConversationActivity.this, + R.style.OnboardingDialogTheme).setTarget(target) + .setPrimaryText(R.string.introduction_onboarding_title) + .setSecondaryText(R.string.introduction_onboarding_text) + .setIcon(R.drawable.ic_more_vert_accent) + .setPromptStateChangeListener(listener) + .show(); - @Override - public void onHidePromptComplete() { - } - }; - new MaterialTapTargetPrompt.Builder(ConversationActivity.this) - .setTarget(target) - .setPrimaryText(R.string.introduction_onboarding_title) - .setSecondaryText(R.string.introduction_onboarding_text) - .setBackgroundColourFromRes(R.color.briar_primary) - .setIcon(R.drawable.ic_more_vert_accent) - .setOnHidePromptListener(listener) - .show(); }); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItemViewHolder.java index e58ed523c91d001f31d74f44be7e4f109aa4790e..2d0763a3b85e20a5b1ea3b3823bd56335749aec0 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItemViewHolder.java @@ -22,9 +22,9 @@ class ConversationItemViewHolder extends ViewHolder { ConversationItemViewHolder(View v) { super(v); - layout = (ViewGroup) v.findViewById(R.id.layout); - text = (TextView) v.findViewById(R.id.text); - time = (TextView) v.findViewById(R.id.time); + layout = v.findViewById(R.id.layout); + text = v.findViewById(R.id.text); + time = v.findViewById(R.id.time); } @CallSuper diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeInViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeInViewHolder.java index db6bbd89b3f804bd282e3780db778905f3da04e3..a77ec07bac37792fb45f182508f023c7f1a33d3c 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeInViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeInViewHolder.java @@ -19,7 +19,7 @@ class ConversationNoticeInViewHolder extends ConversationItemViewHolder { ConversationNoticeInViewHolder(View v) { super(v); - msgText = (TextView) v.findViewById(R.id.msgText); + msgText = v.findViewById(R.id.msgText); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutViewHolder.java index 504137ada8fe3caa13d60683129d0d53c46f6c96..d762018fba584f1a0432072ee8dbc9e9b822a787 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutViewHolder.java @@ -19,7 +19,7 @@ class ConversationNoticeOutViewHolder extends ConversationOutItemViewHolder { ConversationNoticeOutViewHolder(View v) { super(v); - msgText = (TextView) v.findViewById(R.id.msgText); + msgText = v.findViewById(R.id.msgText); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationOutItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationOutItemViewHolder.java index 8e5bf264da3c7be9ab5861c6f13cc77ec13bd222..39fa86887db86aeaafda565dcc84412241e750a3 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationOutItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationOutItemViewHolder.java @@ -16,7 +16,7 @@ abstract class ConversationOutItemViewHolder ConversationOutItemViewHolder(View v) { super(v); - status = (ImageView) v.findViewById(R.id.status); + status = v.findViewById(R.id.status); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationRequestViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationRequestViewHolder.java index f5718c1dc9c97cc80daf55613d512ac5997278d0..b3f53a74fc91a29cfc26341744205f81e088fdfb 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationRequestViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationRequestViewHolder.java @@ -20,8 +20,8 @@ class ConversationRequestViewHolder extends ConversationNoticeInViewHolder { ConversationRequestViewHolder(View v) { super(v); - acceptButton = (Button) v.findViewById(R.id.acceptButton); - declineButton = (Button) v.findViewById(R.id.declineButton); + acceptButton = v.findViewById(R.id.acceptButton); + declineButton = v.findViewById(R.id.declineButton); } void bind(ConversationItem conversationItem, diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseContactSelectorFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseContactSelectorFragment.java index 7b3f681e90d1775ea7589907cbcabaec4fc7af2f..03e6ff06b9de33576433d2bcba4e17f5a20bf255 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseContactSelectorFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseContactSelectorFragment.java @@ -67,7 +67,7 @@ public abstract class BaseContactSelectorFragment<I extends SelectableContactIte View contentView = inflater.inflate(R.layout.list, container, false); - list = (BriarRecyclerView) contentView.findViewById(R.id.list); + list = contentView.findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setEmptyText(getString(R.string.no_contacts_selector)); adapter = getAdapter(getContext(), this); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseSelectableContactHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseSelectableContactHolder.java index e0fe9a688e13aa7e772b76ea2596a44707135269..fd69f6c12b29bf54db77586eb58fe961237c6011 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseSelectableContactHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contactselection/BaseSelectableContactHolder.java @@ -24,8 +24,8 @@ public class BaseSelectableContactHolder<I extends SelectableContactItem> public BaseSelectableContactHolder(View v) { super(v); - checkBox = (CheckBox) v.findViewById(R.id.checkBox); - info = (TextView) v.findViewById(R.id.infoView); + checkBox = v.findViewById(R.id.checkBox); + info = v.findViewById(R.id.infoView); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java index 6a87b3b7120032d6287c796f5ce4c498d10903bd..2015be8db47c736b58688f8d763281eb79933d12 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java @@ -54,9 +54,8 @@ public class CreateForumActivity extends BriarActivity { setContentView(R.layout.activity_create_forum); - nameEntryLayout = - (TextInputLayout) findViewById(R.id.createForumNameLayout); - nameEntry = (EditText) findViewById(R.id.createForumNameEntry); + nameEntryLayout = findViewById(R.id.createForumNameLayout); + nameEntry = findViewById(R.id.createForumNameEntry); nameEntry.addTextChangedListener(new TextWatcher() { @Override @@ -79,10 +78,10 @@ public class CreateForumActivity extends BriarActivity { return true; }); - createForumButton = (Button) findViewById(R.id.createForumButton); + createForumButton = findViewById(R.id.createForumButton); createForumButton.setOnClickListener(v -> createForum()); - progress = (ProgressBar) findViewById(R.id.createForumProgressBar); + progress = findViewById(R.id.createForumProgressBar); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListAdapter.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListAdapter.java index c46833fe2dd5fcd0de9759785b05c4f7afd15421..b49ba9d6b4e674f19caba960489387ea5ec1fbfa 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListAdapter.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListAdapter.java @@ -133,10 +133,10 @@ class ForumListAdapter super(v); layout = (ViewGroup) v; - avatar = (TextAvatarView) v.findViewById(R.id.avatarView); - name = (TextView) v.findViewById(R.id.forumNameView); - postCount = (TextView) v.findViewById(R.id.postCountView); - date = (TextView) v.findViewById(R.id.dateView); + avatar = v.findViewById(R.id.avatarView); + name = v.findViewById(R.id.forumNameView); + postCount = v.findViewById(R.id.postCountView); + date = v.findViewById(R.id.dateView); } } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java index 5fcf22ecf352d69c9bcdf1b405cc77332e2602b6..af52ab94360633ef447ddf9028dbcb4f930ee773 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java @@ -92,7 +92,7 @@ public class ForumListFragment extends BaseEventFragment implements adapter = new ForumListAdapter(getActivity()); - list = (BriarRecyclerView) contentView.findViewById(R.id.forumList); + list = contentView.findViewById(R.id.forumList); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setAdapter(adapter); list.setEmptyText(getString(R.string.no_forums)); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/introduction/ContactChooserFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/introduction/ContactChooserFragment.java index 99ccd1f3bd9ad8fd7f469b844994cc93330da8c2..252ed6734b804decfa165b11b3e612d19d3badc8 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/introduction/ContactChooserFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/introduction/ContactChooserFragment.java @@ -78,7 +78,7 @@ public class ContactChooserFragment extends BaseFragment { }; adapter = new ContactListAdapter(getActivity(), onContactClickListener); - list = (BriarRecyclerView) contentView.findViewById(R.id.list); + list = contentView.findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setAdapter(adapter); list.setEmptyText(getString(R.string.no_contacts)); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/introduction/IntroductionMessageFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/introduction/IntroductionMessageFragment.java index 52fcd30cba4a1916c1479c6873742257b8eda3c5..3a76421b375e9c8f9b51ac4fa6976a923cd56582 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/introduction/IntroductionMessageFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/introduction/IntroductionMessageFragment.java @@ -211,13 +211,12 @@ public class IntroductionMessageFragment extends BaseFragment private final TextInputView message; private ViewHolder(View v) { - progressBar = (ProgressBar) v.findViewById(R.id.progressBar); - avatar1 = (CircleImageView) v.findViewById(R.id.avatarContact1); - avatar2 = (CircleImageView) v.findViewById(R.id.avatarContact2); - contactName1 = (TextView) v.findViewById(R.id.nameContact1); - contactName2 = (TextView) v.findViewById(R.id.nameContact2); - message = (TextInputView) v - .findViewById(R.id.introductionMessageView); + progressBar = v.findViewById(R.id.progressBar); + avatar1 = v.findViewById(R.id.avatarContact1); + avatar2 = v.findViewById(R.id.avatarContact2); + contactName1 = v.findViewById(R.id.nameContact1); + contactName2 = v.findViewById(R.id.nameContact2); + message = v.findViewById(R.id.introductionMessageView); } } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/IntroFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/IntroFragment.java index f1112729794cee833ada6a697dd44f716c042a7f..4a94db19011465f99a1f1629e0c7ffec96abf813 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/IntroFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/IntroFragment.java @@ -63,7 +63,7 @@ public class IntroFragment extends BaseFragment { View v = inflater.inflate(R.layout.fragment_keyagreement_id, container, false); - scrollView = (ScrollView) v.findViewById(R.id.scrollView); + scrollView = v.findViewById(R.id.scrollView); View button = v.findViewById(R.id.continueButton); button.setOnClickListener(view -> screenSeenListener.showNextScreen()); return v; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/KeyAgreementActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/KeyAgreementActivity.java index e866662dca5e2d4ed38fe66c773e002b2d0f1551..040312127b7f850a007d6dd82fc6f27e632a8997 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/KeyAgreementActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/KeyAgreementActivity.java @@ -75,7 +75,7 @@ public class KeyAgreementActivity extends BriarActivity implements super.onCreate(state); setContentView(R.layout.activity_fragment_container_toolbar); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java index ae01d66c49b5b0f866fd56b91e9a0bd25009b79d..54df56f3ae9caab020390a4e14aacd670a42c82d 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java @@ -124,14 +124,12 @@ public class ShowQrCodeFragment extends BaseEventFragment public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - cameraView = (CameraView) view.findViewById(R.id.camera_view); + cameraView = view.findViewById(R.id.camera_view); statusView = view.findViewById(R.id.status_container); - status = (TextView) view.findViewById(R.id.connect_status); - qrCode = (ImageView) view.findViewById(R.id.qr_code); - mainProgressTitle = - (TextView) view.findViewById(R.id.title_progress_bar); - mainProgressContainer = - (ViewGroup) view.findViewById(R.id.container_progress); + status = view.findViewById(R.id.connect_status); + qrCode = view.findViewById(R.id.qr_code); + mainProgressTitle = view.findViewById(R.id.title_progress_bar); + mainProgressContainer = view.findViewById(R.id.container_progress); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/AuthorNameFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/login/AuthorNameFragment.java index 303d79d1507710f63a99df877234c1356bd566da..ec28c6563e7c773ffaaf3e65dc5741c5395504b3 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/AuthorNameFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/AuthorNameFragment.java @@ -35,11 +35,9 @@ public class AuthorNameFragment extends SetupFragment { getActivity().setTitle(getString(R.string.setup_title)); View v = inflater.inflate(R.layout.fragment_setup_author_name, container, false); - authorNameWrapper = - (TextInputLayout) v.findViewById(R.id.nickname_entry_wrapper); - authorNameInput = - (TextInputEditText) v.findViewById(R.id.nickname_entry); - nextButton = (Button) v.findViewById(R.id.next); + authorNameWrapper = v.findViewById(R.id.nickname_entry_wrapper); + authorNameInput = v.findViewById(R.id.nickname_entry); + nextButton = v.findViewById(R.id.next); authorNameInput.addTextChangedListener(this); nextButton.setOnClickListener(this); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/ChangePasswordActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/login/ChangePasswordActivity.java index cc460deb7e1d1689205393244a72c31e459cb0c0..cabab8e9ec9065ee82083b2dc7d85dddde3f7a45 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/ChangePasswordActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/ChangePasswordActivity.java @@ -49,20 +49,16 @@ public class ChangePasswordActivity extends BaseActivity setContentView(R.layout.activity_change_password); currentPasswordEntryWrapper = - (TextInputLayout) findViewById( - R.id.current_password_entry_wrapper); - newPasswordEntryWrapper = - (TextInputLayout) findViewById(R.id.new_password_entry_wrapper); + findViewById(R.id.current_password_entry_wrapper); + newPasswordEntryWrapper = findViewById(R.id.new_password_entry_wrapper); newPasswordConfirmationWrapper = - (TextInputLayout) findViewById( - R.id.new_password_confirm_wrapper); - currentPassword = (EditText) findViewById(R.id.current_password_entry); - newPassword = (EditText) findViewById(R.id.new_password_entry); - newPasswordConfirmation = - (EditText) findViewById(R.id.new_password_confirm); - strengthMeter = (StrengthMeter) findViewById(R.id.strength_meter); - changePasswordButton = (Button) findViewById(R.id.change_password); - progress = (ProgressBar) findViewById(R.id.progress_wheel); + findViewById(R.id.new_password_confirm_wrapper); + currentPassword = findViewById(R.id.current_password_entry); + newPassword = findViewById(R.id.new_password_entry); + newPasswordConfirmation = findViewById(R.id.new_password_confirm); + strengthMeter = findViewById(R.id.strength_meter); + changePasswordButton = findViewById(R.id.change_password); + progress = findViewById(R.id.progress_wheel); TextWatcher tw = new TextWatcher() { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/DozeFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/login/DozeFragment.java index 005c600d86b902621e397605d94b31601ad01efe..cb77e3d9fa1d23c2f10d4d073b9c7b3d84db7a67 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/DozeFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/DozeFragment.java @@ -38,8 +38,8 @@ public class DozeFragment extends SetupFragment { getActivity().setTitle(getString(R.string.setup_doze_title)); View v = inflater.inflate(R.layout.fragment_setup_doze, container, false); - dozeButton = (Button) v.findViewById(R.id.dozeButton); - progressBar = (ProgressBar) v.findViewById(R.id.progress); + dozeButton = v.findViewById(R.id.dozeButton); + progressBar = v.findViewById(R.id.progress); dozeButton.setOnClickListener(view -> askForDozeWhitelisting()); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordActivity.java index ec0ccb5721a8d3dabb1ef5fb458888a9a5bf8b29..c381beb36f20073b13cf49e55b74cce44d773680 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordActivity.java @@ -53,10 +53,10 @@ public class PasswordActivity extends BaseActivity { } setContentView(R.layout.activity_password); - signInButton = (Button) findViewById(R.id.btn_sign_in); - progress = (ProgressBar) findViewById(R.id.progress_wheel); - input = (TextInputLayout) findViewById(R.id.password_layout); - password = (EditText) findViewById(R.id.edit_password); + signInButton = findViewById(R.id.btn_sign_in); + progress = findViewById(R.id.progress_wheel); + input = findViewById(R.id.password_layout); + password = findViewById(R.id.edit_password); password.setOnEditorActionListener((v, actionId, event) -> { validatePassword(); return true; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordFragment.java index 0106892a15c12c177b1011d9161ad0cf703eeece..17f7e06eb16d2a3700be32ff7f3634f75d84a0c3 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordFragment.java @@ -40,16 +40,14 @@ public class PasswordFragment extends SetupFragment { View v = inflater.inflate(R.layout.fragment_setup_password, container, false); - strengthMeter = (StrengthMeter) v.findViewById(R.id.strength_meter); - passwordEntryWrapper = - (TextInputLayout) v.findViewById(R.id.password_entry_wrapper); - passwordEntry = (TextInputEditText) v.findViewById(R.id.password_entry); + strengthMeter = v.findViewById(R.id.strength_meter); + passwordEntryWrapper = v.findViewById(R.id.password_entry_wrapper); + passwordEntry = v.findViewById(R.id.password_entry); passwordConfirmationWrapper = - (TextInputLayout) v.findViewById(R.id.password_confirm_wrapper); - passwordConfirmation = - (TextInputEditText) v.findViewById(R.id.password_confirm); - nextButton = (Button) v.findViewById(R.id.next); - progressBar = (ProgressBar) v.findViewById(R.id.progress); + v.findViewById(R.id.password_confirm_wrapper); + passwordConfirmation = v.findViewById(R.id.password_confirm); + nextButton = v.findViewById(R.id.next); + progressBar = v.findViewById(R.id.progress); passwordEntry.addTextChangedListener(this); passwordConfirmation.addTextChangedListener(this); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/navdrawer/NavDrawerActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/navdrawer/NavDrawerActivity.java index c5e4a5b12623f708bbfce6b837b920a8125c209c..468d88cd0ecf07ee1c35990db8058abd85694092 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/navdrawer/NavDrawerActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/navdrawer/NavDrawerActivity.java @@ -109,10 +109,10 @@ public class NavDrawerActivity extends BriarActivity implements exitIfStartupFailed(getIntent()); setContentView(R.layout.activity_nav_drawer); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); - navigation = (NavigationView) findViewById(R.id.navigation); - GridView transportsView = (GridView) findViewById(R.id.transportsView); + Toolbar toolbar = findViewById(R.id.toolbar); + drawerLayout = findViewById(R.id.drawer_layout); + navigation = findViewById(R.id.navigation); + GridView transportsView = findViewById(R.id.transportsView); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -294,12 +294,12 @@ public class NavDrawerActivity extends BriarActivity implements if (daysUntilExpiry < 0) signOut(); // show expiry warning text - ViewGroup expiryWarning = (ViewGroup) findViewById(R.id.expiryWarning); + ViewGroup expiryWarning = findViewById(R.id.expiryWarning); TextView expiryWarningText = - (TextView) expiryWarning.findViewById(R.id.expiryWarningText); + expiryWarning.findViewById(R.id.expiryWarningText); // make close button functional ImageView expiryWarningClose = - (ImageView) expiryWarning.findViewById(R.id.expiryWarningClose); + expiryWarning.findViewById(R.id.expiryWarningClose); // show a different snackbar in green if this is an update if (expiry == UPDATE) { @@ -386,12 +386,12 @@ public class NavDrawerActivity extends BriarActivity implements android.R.color.tertiary_text_light); } - ImageView icon = (ImageView) view.findViewById(R.id.imageView); + ImageView icon = view.findViewById(R.id.imageView); icon.setImageDrawable(ContextCompat .getDrawable(NavDrawerActivity.this, t.iconId)); icon.setColorFilter(c); - TextView text = (TextView) view.findViewById(R.id.textView); + TextView text = view.findViewById(R.id.textView); text.setText(getString(t.textId)); return view; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/creation/CreateGroupFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/creation/CreateGroupFragment.java index c8a6bac35d1e6e1ecf6067ccd7f8451c2d6ed10c..c402bcb4ad4209cd9198db26219998a7054a2057 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/creation/CreateGroupFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/creation/CreateGroupFragment.java @@ -43,7 +43,7 @@ public class CreateGroupFragment extends BaseFragment { View v = inflater.inflate(R.layout.fragment_create_group, container, false); - nameEntry = (EditText) v.findViewById(R.id.name); + nameEntry = v.findViewById(R.id.name); nameEntry.addTextChangedListener(new TextWatcher() { @Override @@ -66,12 +66,12 @@ public class CreateGroupFragment extends BaseFragment { return true; }); - nameLayout = (TextInputLayout) v.findViewById(R.id.nameLayout); + nameLayout = v.findViewById(R.id.nameLayout); - createGroupButton = (Button) v.findViewById(R.id.button); + createGroupButton = v.findViewById(R.id.button); createGroupButton.setOnClickListener(v1 -> createGroup()); - progress = (ProgressBar) v.findViewById(R.id.progressBar); + progress = v.findViewById(R.id.progressBar); return v; } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java index fbcce8cf5a9c8818fe4a93ee169e07a65741e269..548fa95336e110b4e955f9f7840636d3db11c72c 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java @@ -68,7 +68,7 @@ public class GroupListFragment extends BaseFragment implements View v = inflater.inflate(R.layout.list, container, false); adapter = new GroupListAdapter(getContext(), this); - list = (BriarRecyclerView) v.findViewById(R.id.list); + list = v.findViewById(R.id.list); list.setEmptyText(R.string.groups_list_empty); list.setLayoutManager(new LinearLayoutManager(getContext())); list.setAdapter(adapter); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java index 15219e5859316ad6b2a74cfc659e91178cb4b266..e09e371bf577eef70bdd422ed623b2f46d1df4a0 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java @@ -41,13 +41,13 @@ class GroupViewHolder extends RecyclerView.ViewHolder { super(v); layout = (ViewGroup) v; - avatar = (TextAvatarView) v.findViewById(R.id.avatarView); - name = (TextView) v.findViewById(R.id.nameView); - creator = (TextView) v.findViewById(R.id.creatorView); - postCount = (TextView) v.findViewById(R.id.messageCountView); - date = (TextView) v.findViewById(R.id.dateView); - status = (TextView) v.findViewById(R.id.statusView); - remove = (Button) v.findViewById(R.id.removeButton); + avatar = v.findViewById(R.id.avatarView); + name = v.findViewById(R.id.nameView); + creator = v.findViewById(R.id.creatorView); + postCount = v.findViewById(R.id.messageCountView); + date = v.findViewById(R.id.dateView); + status = v.findViewById(R.id.statusView); + remove = v.findViewById(R.id.removeButton); } void bindView(Context ctx, GroupItem group, diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/GroupMemberListActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/GroupMemberListActivity.java index e893ecf888db4a0dc48862c0e62ed22e9a9f4156..5538a26a447c91095c9a4d6581a5203dc281cb07 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/GroupMemberListActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/GroupMemberListActivity.java @@ -48,13 +48,13 @@ public class GroupMemberListActivity extends BriarActivity { if (b == null) throw new IllegalStateException("No GroupId in intent."); groupId = new GroupId(b); - list = (BriarRecyclerView) findViewById(R.id.list); + list = findViewById(R.id.list); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); list.setLayoutManager(linearLayoutManager); adapter = new MemberListAdapter(this); list.setAdapter(adapter); - TextView info = (TextView) findViewById(R.id.info); + TextView info = findViewById(R.id.info); info.setText(R.string.sharing_status_groups); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/MemberListItemHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/MemberListItemHolder.java index 4a242bcec32eab8d067cec193cbf003be08719c3..002f80db2e6f2a3a58605d4594904f4629a4be00 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/MemberListItemHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/memberlist/MemberListItemHolder.java @@ -22,9 +22,9 @@ class MemberListItemHolder extends RecyclerView.ViewHolder { MemberListItemHolder(View v) { super(v); - author = (AuthorView) v.findViewById(R.id.authorView); - bulb = (ImageView) v.findViewById(R.id.bulbView); - creator = (TextView) v.findViewById(R.id.creatorView); + author = v.findViewById(R.id.authorView); + bulb = v.findViewById(R.id.bulbView); + creator = v.findViewById(R.id.creatorView); } protected void bind(MemberListItem item) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealContactsActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealContactsActivity.java index 79a287755bc75f1d33bdd19797c96e2abf60124a..239269e6a3a7e0ad822a1f127d5682e8dc0cdeeb 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealContactsActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealContactsActivity.java @@ -52,7 +52,7 @@ public class RevealContactsActivity extends ContactSelectorActivity if (b == null) throw new IllegalStateException("No GroupId"); groupId = new GroupId(b); - button = (Button) findViewById(R.id.revealButton); + button = findViewById(R.id.revealButton); button.setOnClickListener(this); button.setEnabled(false); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealableContactViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealableContactViewHolder.java index 585e2f622be02cf34ccb20e0e64771f726f990b0..ab7777f4bdffc38789b722d627c35f4f9e40d563 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealableContactViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/reveal/RevealableContactViewHolder.java @@ -25,7 +25,7 @@ class RevealableContactViewHolder RevealableContactViewHolder(View v) { super(v); - icon = (ImageView) v.findViewById(R.id.visibilityView); + icon = v.findViewById(R.id.visibilityView); } @Override diff --git a/briar-android/src/main/java/org/briarproject/briar/android/reporting/DevReportActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/reporting/DevReportActivity.java index 2091e65b612d6936fe9c10875ed3581c0b3513de..a25e1e41fcb728116f91a9d04e4850720fecbc8b 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/reporting/DevReportActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/reporting/DevReportActivity.java @@ -90,15 +90,15 @@ public class DevReportActivity extends BaseCrashReportDialog getDelegate().setContentView(R.layout.activity_dev_report); - Toolbar tb = (Toolbar) findViewById(R.id.toolbar); + Toolbar tb = findViewById(R.id.toolbar); getDelegate().setSupportActionBar(tb); View requestReport = findViewById(R.id.request_report); - userCommentView = (EditText) findViewById(R.id.user_comment); - userEmailView = (EditText) findViewById(R.id.user_email); - includeDebugReport = (CheckBox) findViewById(R.id.include_debug_report); - chevron = (Button) findViewById(R.id.chevron); - report = (LinearLayout) findViewById(R.id.report_content); + userCommentView = findViewById(R.id.user_comment); + userEmailView = findViewById(R.id.user_email); + includeDebugReport = findViewById(R.id.include_debug_report); + chevron = findViewById(R.id.chevron); + report = findViewById(R.id.report_content); progress = findViewById(R.id.progress_wheel); //noinspection ConstantConditions @@ -262,7 +262,7 @@ public class DevReportActivity extends BaseCrashReportDialog boolean excluded = excludedFields.contains(field); View v = inflater.inflate(R.layout.list_item_crash, report, false); - CheckBox cb = (CheckBox) v + CheckBox cb = v .findViewById(R.id.include_in_report); cb.setTag(field); cb.setChecked(required || !excluded); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/BaseMessageFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/BaseMessageFragment.java index 026498b12facc43a1aa3e4612972e2db09ff41ee..75d999c9b00a8e2918abc51af3cd79c5fbd634dc 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/BaseMessageFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/BaseMessageFragment.java @@ -40,7 +40,7 @@ public abstract class BaseMessageFragment extends BaseFragment // inflate view View v = inflater.inflate(R.layout.fragment_message, container, false); - message = (LargeTextInputView) v.findViewById(R.id.messageView); + message = v.findViewById(R.id.messageView); message.setButtonText(getString(getButtonText())); message.setHint(getHintText()); message.setListener(this); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationActivity.java index bc755d43a32f383adb3f76968cf88bfea428ea2f..77d3b2eb354c917e1ae24a7cbf2ba8f905284546 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationActivity.java @@ -44,7 +44,7 @@ public abstract class InvitationActivity<I extends InvitationItem> setContentView(R.layout.list); adapter = getAdapter(this, this); - list = (BriarRecyclerView) findViewById(R.id.list); + list = findViewById(R.id.list); if (list != null) { list.setLayoutManager(new LinearLayoutManager(this)); list.setAdapter(adapter); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationViewHolder.java index ef21497ce1c56832185c44791f5f21c18948ec3d..0a258b2c2506b5e2b5dcea29dec6d2b8abbf9bf8 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationViewHolder.java @@ -29,12 +29,12 @@ public class InvitationViewHolder<I extends InvitationItem> public InvitationViewHolder(View v) { super(v); - avatar = (TextAvatarView) v.findViewById(R.id.avatarView); - name = (TextView) v.findViewById(R.id.forumNameView); - sharedBy = (TextView) v.findViewById(R.id.sharedByView); - subscribed = (TextView) v.findViewById(R.id.forumSubscribedView); - accept = (Button) v.findViewById(R.id.acceptButton); - decline = (Button) v.findViewById(R.id.declineButton); + avatar = v.findViewById(R.id.avatarView); + name = v.findViewById(R.id.forumNameView); + sharedBy = v.findViewById(R.id.sharedByView); + subscribed = v.findViewById(R.id.forumSubscribedView); + accept = v.findViewById(R.id.acceptButton); + decline = v.findViewById(R.id.declineButton); } @CallSuper diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/SharingStatusActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/SharingStatusActivity.java index efe97420574cf88f27ca2359e53a28202b183a96..6087e38e680267e6e8259a3f810777d5dad0e01a 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/SharingStatusActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/SharingStatusActivity.java @@ -54,13 +54,13 @@ abstract class SharingStatusActivity extends BriarActivity { if (b == null) throw new IllegalStateException("No GroupId"); groupId = new GroupId(b); - list = (BriarRecyclerView) findViewById(R.id.list); + list = findViewById(R.id.list); adapter = new SharingStatusAdapter(this); list.setLayoutManager(new LinearLayoutManager(this)); list.setAdapter(adapter); list.setEmptyText(getString(R.string.nobody)); - TextView info = (TextView) findViewById(R.id.info); + TextView info = findViewById(R.id.info); info.setText(getInfoText()); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/threaded/BaseThreadItemViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/threaded/BaseThreadItemViewHolder.java index aac9621a2dd2e17ab23f540c5c46f94694c40bed..0532e6a9512b22ee2cfeb1474822281760a4252d 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/threaded/BaseThreadItemViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/threaded/BaseThreadItemViewHolder.java @@ -34,9 +34,9 @@ public abstract class BaseThreadItemViewHolder<I extends ThreadItem> public BaseThreadItemViewHolder(View v) { super(v); - layout = (ViewGroup) v.findViewById(R.id.layout); - textView = (TextView) v.findViewById(R.id.text); - author = (AuthorView) v.findViewById(R.id.author); + layout = v.findViewById(R.id.layout); + textView = v.findViewById(R.id.text); + author = v.findViewById(R.id.author); } @CallSuper diff --git a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListActivity.java index 2e5d62ac5867ac1e68bcfaf1c45451fe5480220b..3515459e17a0bee945855d7e5f8eb953b2ac3b22 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListActivity.java @@ -85,9 +85,9 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI groupId = new GroupId(b); getController().setGroupId(groupId); - textInput = (TextInputView) findViewById(R.id.text_input_container); + textInput = findViewById(R.id.text_input_container); textInput.setListener(this); - list = (BriarRecyclerView) findViewById(R.id.list); + list = findViewById(R.id.list); layoutManager = new LinearLayoutManager(this); list.setLayoutManager(layoutManager); adapter = createAdapter(layoutManager); @@ -114,8 +114,8 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI } } }); - upButton = (UnreadMessageButton) findViewById(R.id.upButton); - downButton = (UnreadMessageButton) findViewById(R.id.downButton); + upButton = findViewById(R.id.upButton); + downButton = findViewById(R.id.downButton); upButton.setOnClickListener(v -> { int position = adapter.getVisibleUnreadPosTop(); if (position != NO_POSITION) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadPostViewHolder.java b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadPostViewHolder.java index dbab681c588445f6953b63a6a34a0687c29e2a3c..62344474afcab2cec2891fb1190ae277c29c8c7c 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadPostViewHolder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadPostViewHolder.java @@ -28,7 +28,7 @@ public class ThreadPostViewHolder<I extends ThreadItem> public ThreadPostViewHolder(View v) { super(v); - lvlText = (TextView) v.findViewById(R.id.nested_line_text); + lvlText = v.findViewById(R.id.nested_line_text); lvls = new View[nestedLineIds.length]; for (int i = 0; i < lvls.length; i++) { lvls[i] = v.findViewById(nestedLineIds[i]); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/util/BriarNotificationBuilder.java b/briar-android/src/main/java/org/briarproject/briar/android/util/BriarNotificationBuilder.java index 73c50d8dd901985d7cd49108c0c8e23300cbcfd7..2db7fdd1fb652f3c174d9d3b327f100d31bf29e2 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/util/BriarNotificationBuilder.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/util/BriarNotificationBuilder.java @@ -3,8 +3,8 @@ package org.briarproject.briar.android.util; import android.content.Context; import android.os.Build; import android.support.annotation.ColorRes; +import android.support.v4.app.NotificationCompat; import android.support.v4.content.ContextCompat; -import android.support.v7.app.NotificationCompat; import static android.support.v4.app.NotificationCompat.VISIBILITY_PRIVATE; import static android.support.v4.app.NotificationCompat.VISIBILITY_SECRET; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/AuthorView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/AuthorView.java index e4cddd8c4b1d63eeec02d4e9b540a35dc5619432..117ce12cbe32b5e5db5cd5d2dfa3a044f146ed14 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/AuthorView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/AuthorView.java @@ -53,12 +53,12 @@ public class AuthorView extends RelativeLayout { .getSystemService(LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.author_view, this, true); - avatar = (CircleImageView) findViewById(R.id.avatar); - avatarIcon = (ImageView) findViewById(R.id.avatarIcon); - authorName = (TextView) findViewById(R.id.authorName); + avatar = findViewById(R.id.avatar); + avatarIcon = findViewById(R.id.avatarIcon); + authorName = findViewById(R.id.authorName); authorNameTypeface = authorName.getTypeface(); - date = (TextView) findViewById(R.id.dateView); - trustIndicator = (TrustIndicatorView) findViewById(R.id.trustIndicator); + date = findViewById(R.id.dateView); + trustIndicator = findViewById(R.id.trustIndicator); TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.AuthorView); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java index d90b7f2c62baeae35ba4d6d41282c8dc802fe62d..69d063bf945d52babf1d3f59139c0ad7481a8bbe 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java @@ -67,9 +67,9 @@ public class BriarRecyclerView extends FrameLayout { View v = LayoutInflater.from(getContext()).inflate( R.layout.briar_recycler_view, this, true); - recyclerView = (RecyclerView) v.findViewById(R.id.recyclerView); - emptyView = (TextView) v.findViewById(R.id.emptyView); - progressBar = (ProgressBar) v.findViewById(R.id.progressBar); + recyclerView = v.findViewById(R.id.recyclerView); + emptyView = v.findViewById(R.id.emptyView); + progressBar = v.findViewById(R.id.progressBar); showProgressBar(); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/LargeTextInputView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/LargeTextInputView.java index 6b036844932e9f9e15d4eef12ced402dbca34ba7..3cdf8fff8ac67e4cc08f3101929b2e6e95b5c5d2 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/LargeTextInputView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/LargeTextInputView.java @@ -58,8 +58,7 @@ public class LargeTextInputView extends TextInputView { if (buttonText != null) setButtonText(buttonText); if (maxLines > 0) ui.editText.setMaxLines(maxLines); if (fillHeight) { - LinearLayout layout = - (LinearLayout) findViewById(R.id.input_layout); + LinearLayout layout = findViewById(R.id.input_layout); LayoutParams params = (LayoutParams) layout.getLayoutParams(); params.height = 0; params.weight = 1; diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/TextAvatarView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/TextAvatarView.java index 36ee3b4133927f8d52ebc8c0b09f96c22ceb9b4c..9d24bbe7543edfb34faf02b089c13bc99b67c34f 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/TextAvatarView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/TextAvatarView.java @@ -33,11 +33,10 @@ public class TextAvatarView extends FrameLayout { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - inflater - .inflate(R.layout.text_avatar_view, this, true); - character = (AppCompatTextView) findViewById(R.id.textAvatarView); - background = (CircleImageView) findViewById(R.id.avatarBackground); - badge = (TextView) findViewById(R.id.unreadCountView); + inflater.inflate(R.layout.text_avatar_view, this, true); + character = findViewById(R.id.textAvatarView); + background = findViewById(R.id.avatarBackground); + badge = findViewById(R.id.unreadCountView); badge.setVisibility(INVISIBLE); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/TextInputView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/TextInputView.java index ce97e11fb85e7fbc8b8995c33914e030bb46d760..bf83a61dcc2c925e4d11580d1e2364fe107093d1 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/TextInputView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/TextInputView.java @@ -193,9 +193,9 @@ public class TextInputView extends KeyboardAwareLinearLayout final EmojiDrawer emojiDrawer; private ViewHolder() { - emojiToggle = (EmojiToggle) findViewById(R.id.emoji_toggle); - editText = (EmojiEditText) findViewById(R.id.input_text); - emojiDrawer = (EmojiDrawer) findViewById(R.id.emoji_drawer); + emojiToggle = findViewById(R.id.emoji_toggle); + editText = findViewById(R.id.input_text); + emojiDrawer = findViewById(R.id.emoji_drawer); sendButton = findViewById(R.id.btn_send); } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/UnreadMessageButton.java b/briar-android/src/main/java/org/briarproject/briar/android/view/UnreadMessageButton.java index 0270cfea34d2353b1fdcb90b7c8d670883ad0471..ae19023dd91ccfe32845ad5f6eb27565c32f3436 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/UnreadMessageButton.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/UnreadMessageButton.java @@ -39,8 +39,8 @@ public class UnreadMessageButton extends FrameLayout { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.unread_message_button, this, true); - fab = (FloatingActionButton) findViewById(R.id.fab); - unread = (TextView) findViewById(R.id.unreadCountView); + fab = findViewById(R.id.fab); + unread = findViewById(R.id.unreadCountView); TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.UnreadMessageButton); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/widget/LinkDialogFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/widget/LinkDialogFragment.java index 075daecfc857fd32b9d096d66473f9291b1931f1..5889294db209312a1f9e97122e3e86670ca3f4ee 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/widget/LinkDialogFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/widget/LinkDialogFragment.java @@ -48,7 +48,7 @@ public class LinkDialogFragment extends DialogFragment { View v = inflater.inflate(R.layout.fragment_link_dialog, container, false); - TextView urlView = (TextView) v.findViewById(R.id.urlView); + TextView urlView = v.findViewById(R.id.urlView); urlView.setText(url); // prepare normal intent or intent chooser @@ -60,13 +60,13 @@ public class LinkDialogFragment extends DialogFragment { Intent intent = choice ? Intent.createChooser(i, getString(R.string.link_warning_open_link)) : i; - Button openButton = (Button) v.findViewById(R.id.openButton); + Button openButton = v.findViewById(R.id.openButton); openButton.setOnClickListener(v1 -> { startActivity(intent); getDialog().dismiss(); }); - Button cancelButton = (Button) v.findViewById(R.id.cancelButton); + Button cancelButton = v.findViewById(R.id.cancelButton); cancelButton.setOnClickListener(v1 -> getDialog().cancel()); return v; diff --git a/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiDrawer.java b/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiDrawer.java index 43a1340e78889ef09fd2dac50e01e1b00c410538..7ba1810f9e7e316a94b6f409e1ba7c42792874f8 100644 --- a/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiDrawer.java +++ b/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiDrawer.java @@ -72,11 +72,10 @@ public class EmojiDrawer extends LinearLayout { } private void initializeResources(View v) { - this.pager = (ViewPager) v.findViewById(R.id.emoji_pager); - this.strip = (PagerSlidingTabStrip) v.findViewById(R.id.tabs); + this.pager = v.findViewById(R.id.emoji_pager); + this.strip = v.findViewById(R.id.tabs); - RepeatableImageKey backspace = - (RepeatableImageKey) v.findViewById(R.id.backspace); + RepeatableImageKey backspace = v.findViewById(R.id.backspace); backspace.setOnKeyEventListener(() -> { if (listener != null) listener.onKeyEvent(DELETE_KEY_EVENT); }); diff --git a/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiPageView.java b/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiPageView.java index 4b186e634f056e38ebf864c356d4992db0fe8b45..91598c381ee741e7cfe4808a3455d3c1c4599b04 100644 --- a/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiPageView.java +++ b/briar-android/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiPageView.java @@ -35,7 +35,7 @@ public class EmojiPageView extends FrameLayout { super(context, attrs, defStyleAttr); View view = LayoutInflater.from(getContext()) .inflate(R.layout.emoji_grid_layout, this, true); - grid = (GridView) view.findViewById(R.id.emoji); + grid = view.findViewById(R.id.emoji); grid.setColumnWidth(getResources() .getDimensionPixelSize(R.dimen.emoji_drawer_size) + 2 * getResources().getDimensionPixelSize( diff --git a/briar-android/src/test/java/org/briarproject/briar/android/login/ChangePasswordActivityTest.java b/briar-android/src/test/java/org/briarproject/briar/android/login/ChangePasswordActivityTest.java index 852624f79ebd64af2b70642877624db4d352bf86..a41a949c6b5b3638ef0218a41cb71822c6b2e121 100644 --- a/briar-android/src/test/java/org/briarproject/briar/android/login/ChangePasswordActivityTest.java +++ b/briar-android/src/test/java/org/briarproject/briar/android/login/ChangePasswordActivityTest.java @@ -55,17 +55,17 @@ public class ChangePasswordActivityTest { MockitoAnnotations.initMocks(this); changePasswordActivity = Robolectric.setupActivity(TestChangePasswordActivity.class); - passwordConfirmationWrapper = (TextInputLayout) changePasswordActivity + passwordConfirmationWrapper = changePasswordActivity .findViewById(R.id.new_password_confirm_wrapper); - currentPassword = (EditText) changePasswordActivity + currentPassword = changePasswordActivity .findViewById(R.id.current_password_entry); - newPassword = (EditText) changePasswordActivity + newPassword = changePasswordActivity .findViewById(R.id.new_password_entry); - newPasswordConfirmation = (EditText) changePasswordActivity + newPasswordConfirmation = changePasswordActivity .findViewById(R.id.new_password_confirm); - strengthMeter = (StrengthMeter) changePasswordActivity + strengthMeter = changePasswordActivity .findViewById(R.id.strength_meter); - changePasswordButton = (Button) changePasswordActivity + changePasswordButton = changePasswordActivity .findViewById(R.id.change_password); } diff --git a/briar-android/src/test/java/org/briarproject/briar/android/login/PasswordFragmentTest.java b/briar-android/src/test/java/org/briarproject/briar/android/login/PasswordFragmentTest.java index 7e13211a42ea09f4fe0ebd704e293745d1d33ee3..490f2653a8a1f410648c589fced92c22e8f4a81a 100644 --- a/briar-android/src/test/java/org/briarproject/briar/android/login/PasswordFragmentTest.java +++ b/briar-android/src/test/java/org/briarproject/briar/android/login/PasswordFragmentTest.java @@ -48,12 +48,12 @@ public class PasswordFragmentTest { startFragment(passwordFragment, SetupActivity.class); View v = passwordFragment.getView(); - passwordEntry = (EditText) v.findViewById(R.id.password_entry); - passwordConfirmation = (EditText) v.findViewById(R.id.password_confirm); + passwordEntry = v.findViewById(R.id.password_entry); + passwordConfirmation = v.findViewById(R.id.password_confirm); passwordConfirmationWrapper = - (TextInputLayout) v.findViewById(R.id.password_confirm_wrapper); - strengthMeter = (StrengthMeter) v.findViewById(R.id.strength_meter); - createAccountButton = (Button) v.findViewById(R.id.next); + v.findViewById(R.id.password_confirm_wrapper); + strengthMeter = v.findViewById(R.id.strength_meter); + createAccountButton = v.findViewById(R.id.next); } @Test diff --git a/briar-android/src/test/java/org/briarproject/briar/android/login/SetupActivityTest.java b/briar-android/src/test/java/org/briarproject/briar/android/login/SetupActivityTest.java index 3f25509033d6c28b2d54624490c69001dd8e6ae8..3541d0bda324baf98f783e8caafdf4db5fb8584e 100644 --- a/briar-android/src/test/java/org/briarproject/briar/android/login/SetupActivityTest.java +++ b/briar-android/src/test/java/org/briarproject/briar/android/login/SetupActivityTest.java @@ -45,10 +45,9 @@ public class SetupActivityTest { public void setUp() { MockitoAnnotations.initMocks(this); setupActivity = Robolectric.setupActivity(SetupActivity.class); - nicknameEntryWrapper = (TextInputLayout) setupActivity - .findViewById(R.id.nickname_entry_wrapper); - nicknameEntry = - (EditText) setupActivity.findViewById(R.id.nickname_entry); + nicknameEntryWrapper = + setupActivity.findViewById(R.id.nickname_entry_wrapper); + nicknameEntry = setupActivity.findViewById(R.id.nickname_entry); } @Test diff --git a/build.gradle b/build.gradle index 24e8f774ed479072e5058159963963db74d690bc..34a7c8331b577eaf6fc39fb7aa3ffe5f5d0b94c9 100644 --- a/build.gradle +++ b/build.gradle @@ -4,9 +4,7 @@ allprojects { repositories { jcenter() mavenLocal() - maven { - url 'https://maven.google.com' - } + google() } } @@ -14,14 +12,14 @@ buildscript { repositories { jcenter() mavenLocal() + google() maven { - url "https://plugins.gradle.org/m2/" + url 'https://plugins.gradle.org/m2/' } - google() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0' + classpath 'com.android.tools.build:gradle:3.0.1' classpath 'net.ltgt.gradle:gradle-apt-plugin:0.9' classpath 'de.undercouch:gradle-download-task:3.2.0' classpath files('libs/gradle-witness.jar')