diff --git a/app/build.gradle b/app/build.gradle index 45a23f7d..f8ad4a6a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "io.lbry.browser" minSdkVersion 21 targetSdkVersion 29 - versionCode 1602 - versionName "0.16.2" + versionCode 1601 + versionName "0.16.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -117,7 +117,6 @@ dependencies { implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.3.1.LTS' - implementation 'org.bitcoinj:bitcoinj-tools:0.14.7' implementation 'org.java-websocket:Java-WebSocket:1.5.1' compileOnly 'org.projectlombok:lombok:1.18.10' @@ -128,8 +127,8 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' - __32bitImplementation 'io.lbry:lbrysdk32:0.81.0' - __64bitImplementation 'io.lbry:lbrysdk64:0.81.0' + __32bitImplementation 'io.lbry:lbrysdk32:0.80.0' + __64bitImplementation 'io.lbry:lbrysdk64:0.80.0' } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 145b4940..306751c9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -68,6 +68,10 @@ + + + + diff --git a/app/src/main/java/io/lbry/browser/FirstRunActivity.java b/app/src/main/java/io/lbry/browser/FirstRunActivity.java index b6d6eecb..ad10a6ef 100644 --- a/app/src/main/java/io/lbry/browser/FirstRunActivity.java +++ b/app/src/main/java/io/lbry/browser/FirstRunActivity.java @@ -15,22 +15,12 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.text.HtmlCompat; import androidx.preference.PreferenceManager; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; - import io.lbry.browser.exceptions.AuthTokenInvalidatedException; import io.lbry.browser.utils.Helper; import io.lbry.browser.utils.Lbry; import io.lbry.browser.utils.LbryAnalytics; import io.lbry.browser.utils.Lbryio; import io.lbry.lbrysdk.LbrynetService; -import io.lbry.lbrysdk.ServiceHelper; -import io.lbry.lbrysdk.Utils; public class FirstRunActivity extends AppCompatActivity { @@ -54,7 +44,12 @@ public class FirstRunActivity extends AppCompatActivity { }); registerAuthReceiver(); - findViewById(R.id.welcome_wait_container).setVisibility(View.VISIBLE); + if (!Lbry.SDK_READY) { + findViewById(R.id.welcome_wait_container).setVisibility(View.VISIBLE); + } else { + authenticate(); + } + IntentFilter filter = new IntentFilter(); filter.addAction(MainActivity.ACTION_SDK_READY); filter.addAction(LbrynetService.ACTION_STOP_SERVICE); @@ -67,38 +62,10 @@ public class FirstRunActivity extends AppCompatActivity { authenticate(); } else if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) { finish(); - if (MainActivity.instance != null) { - MainActivity.instance.finish(); - } } } }; registerReceiver(sdkReceiver, filter); - - CheckInstallIdTask task = new CheckInstallIdTask(this, new CheckInstallIdTask.InstallIdHandler() { - @Override - public void onInstallIdChecked(boolean result) { - // start the sdk from FirstRun - boolean serviceRunning = MainActivity.isServiceRunning(MainActivity.instance, LbrynetService.class); - if (!serviceRunning) { - Lbry.SDK_READY = false; - ServiceHelper.start(MainActivity.instance, "", LbrynetService.class, "lbrynetservice"); - } - - if (result) { - // install_id generated and validated, authenticate now - authenticate(); - return; - } - - // we weren't able to generate the install_id ourselves, depend on the sdk for that - if (Lbry.SDK_READY) { - authenticate(); - return; - } - } - }); - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public void onResume() { @@ -167,75 +134,6 @@ public class FirstRunActivity extends AppCompatActivity { super.onDestroy(); } - private void generateIdAndAuthenticate() { - - } - - private static class CheckInstallIdTask extends AsyncTask { - private Context context; - private InstallIdHandler handler; - public CheckInstallIdTask(Context context, InstallIdHandler handler) { - this.context = context; - this.handler = handler; - } - protected Boolean doInBackground(Void... params) { - // Load the installation id from the file system - String lbrynetDir = String.format("%s/%s", Utils.getAppInternalStorageDir(context), "lbrynet"); - File dir = new File(lbrynetDir); - boolean dirExists = dir.isDirectory(); - if (!dirExists) { - dirExists = dir.mkdirs(); - } - - if (!dirExists) { - return false; - } - - String installIdPath = String.format("%s/install_id", lbrynetDir); - File file = new File(installIdPath); - String installId = null; - if (!file.exists()) { - // generate the install_id - installId = Lbry.generateId(); - BufferedWriter writer = null; - try { - writer = new BufferedWriter(new FileWriter(file)); - writer.write(installId); - android.util.Log.d("LbryMain", "Generated install ID=" + installId); - } catch (IOException ex) { - return false; - } finally { - Helper.closeCloseable(writer); - } - } else { - // read the installation id from the file - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(new FileInputStream(installIdPath))); - installId = reader.readLine(); - } catch (IOException ex) { - return false; - } finally { - Helper.closeCloseable(reader); - } - } - - if (!Helper.isNullOrEmpty(installId)) { - Lbry.INSTALLATION_ID = installId; - } - return !Helper.isNullOrEmpty(installId); - } - protected void onPostExecute(Boolean result) { - if (handler != null) { - handler.onInstallIdChecked(result); - } - } - - public interface InstallIdHandler { - void onInstallIdChecked(boolean result); - } - } - private static class AuthenticateTask extends AsyncTask { private Context context; public AuthenticateTask(Context context) { diff --git a/app/src/main/java/io/lbry/browser/MainActivity.java b/app/src/main/java/io/lbry/browser/MainActivity.java index bd7a7a26..110f01a1 100644 --- a/app/src/main/java/io/lbry/browser/MainActivity.java +++ b/app/src/main/java/io/lbry/browser/MainActivity.java @@ -211,7 +211,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener private static final String SPECIAL_URL_PREFIX = "lbry://?"; private static final int REMOTE_NOTIFICATION_REFRESH_TTL = 300000; // 5 minutes public static final String SKU_SKIP = "lbryskip"; - public static MainActivity instance; private boolean shuttingDown; private Date remoteNotifcationsLastLoaded; @@ -394,7 +393,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener @Override protected void onCreate(Bundle savedInstanceState) { - instance = this; // workaround to fix dark theme because https://issuetracker.google.com/issues/37124582 try { new WebView(this); @@ -1142,14 +1140,12 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener checkFirstRun(); checkNowPlaying(); - if (isFirstRunCompleted()) { - // check (and start) the LBRY SDK service - serviceRunning = isServiceRunning(this, LbrynetService.class); - if (!serviceRunning) { - Lbry.SDK_READY = false; - //findViewById(R.id.global_sdk_initializing_status).setVisibility(View.VISIBLE); - ServiceHelper.start(this, "", LbrynetService.class, "lbrynetservice"); - } + // check (and start) the LBRY SDK service + serviceRunning = isServiceRunning(this, LbrynetService.class); + if (!serviceRunning) { + Lbry.SDK_READY = false; + //findViewById(R.id.global_sdk_initializing_status).setVisibility(View.VISIBLE); + ServiceHelper.start(this, "", LbrynetService.class, "lbrynetservice"); } checkSdkReady(); showSignedInUser(); @@ -1160,11 +1156,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener }*/ } - public boolean isFirstRunCompleted() { - SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); - return sp.getBoolean(PREFERENCE_KEY_INTERNAL_FIRST_RUN_COMPLETED, false); - } - private void checkPurchases() { if (billingClient != null) { Purchase.PurchasesResult result = billingClient.queryPurchases(BillingClient.SkuType.INAPP); diff --git a/app/src/main/java/io/lbry/browser/adapter/ClaimListAdapter.java b/app/src/main/java/io/lbry/browser/adapter/ClaimListAdapter.java index 93b7958d..c36cbf3c 100644 --- a/app/src/main/java/io/lbry/browser/adapter/ClaimListAdapter.java +++ b/app/src/main/java/io/lbry/browser/adapter/ClaimListAdapter.java @@ -323,7 +323,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter 1 ? streamOrChannelName.substring(1) : null; - // It would have thrown already on the RegEx parser if protocol value was incorrect - // open.lbry.com uses ':' as ModSeparators while lbry:// expects '#' - if (components.get(1).equals("open.lbry.com/")) { + /* + * It would have thrown already on the RegEx parser if protocol value was incorrect + * or HTTPS host was unknown to us. + * + * [https://] hosts use ':' as ModSeparators while [lbry://] protocol expects '#' + */ + + if (!components.get(1).isEmpty()) { if (primaryModSeparator.equals(":")) primaryModSeparator = "#"; if (secondaryModSeparator.equals(":")) diff --git a/app/src/main/res/layout/activity_first_run.xml b/app/src/main/res/layout/activity_first_run.xml index 3c4e7a41..181dc545 100644 --- a/app/src/main/res/layout/activity_first_run.xml +++ b/app/src/main/res/layout/activity_first_run.xml @@ -24,7 +24,7 @@ android:id="@+id/welcome_progress_bar" android:layout_width="24dp" android:layout_height="24dp" - android:layout_marginEnd="8dp" + android:layout_marginRight="8dp" android:layout_gravity="center_vertical"/> diff --git a/app/src/main/res/layout/card_invites_by_link.xml b/app/src/main/res/layout/card_invites_by_link.xml index a02d92ba..82853634 100644 --- a/app/src/main/res/layout/card_invites_by_link.xml +++ b/app/src/main/res/layout/card_invites_by_link.xml @@ -24,7 +24,7 @@ android:id="@+id/invites_loading_channels_progress" android:layout_width="20dp" android:layout_height="20dp" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:visibility="gone" /> @@ -54,11 +54,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:layout_toStartOf="@id/invites_copy_invite_link" + android:layout_toLeftOf="@id/invites_copy_invite_link" android:paddingTop="8dp" android:paddingBottom="8dp" - android:paddingStart="12dp" - android:paddingEnd="12dp"> + android:paddingLeft="12dp" + android:paddingRight="12dp"> + android:layout_alignParentRight="true" /> diff --git a/app/src/main/res/layout/card_reward_driver.xml b/app/src/main/res/layout/card_reward_driver.xml index 08f427d9..93fb83b3 100644 --- a/app/src/main/res/layout/card_reward_driver.xml +++ b/app/src/main/res/layout/card_reward_driver.xml @@ -27,8 +27,8 @@ android:layout_centerVertical="true" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_toEndOf="@id/reward_driver_icon" + android:layout_marginLeft="8dp" + android:layout_toRightOf="@id/reward_driver_icon" android:fontFamily="@font/inter" android:lineSpacingMultiplier="1.2" android:textColor="@color/white" diff --git a/app/src/main/res/layout/card_wallet_balance.xml b/app/src/main/res/layout/card_wallet_balance.xml index 15a22b27..550f8849 100644 --- a/app/src/main/res/layout/card_wallet_balance.xml +++ b/app/src/main/res/layout/card_wallet_balance.xml @@ -51,7 +51,7 @@ + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp"> @@ -232,7 +232,7 @@ android:textColor="@color/lbryGreen" /> + android:layout_alignParentRight="true" /> + android:layout_marginLeft="2dp" /> + android:layout_marginLeft="8dp"> + android:layout_marginRight="40dp"> + android:layout_toRightOf="@id/comment_form_avatar_container" + android:layout_marginLeft="16dp"> diff --git a/app/src/main/res/layout/container_inline_channel_form.xml b/app/src/main/res/layout/container_inline_channel_form.xml index 76318b5a..f7900b74 100644 --- a/app/src/main/res/layout/container_inline_channel_form.xml +++ b/app/src/main/res/layout/container_inline_channel_form.xml @@ -42,10 +42,10 @@ + android:layout_marginLeft="2dp" /> @@ -105,15 +105,15 @@ android:layout_width="20dp" android:layout_height="20dp" android:layout_centerVertical="true" - android:layout_marginEnd="24dp" - android:layout_toStartOf="@id/inline_channel_form_create_button" + android:layout_marginRight="24dp" + android:layout_toLeftOf="@id/inline_channel_form_create_button" android:visibility="gone" /> diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index ed30a9f0..a981e4d7 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -104,7 +104,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:layout_marginStart="8dp" + android:layout_marginLeft="8dp" android:fontFamily="@font/inter" android:text="@string/sdk_initializing" android:textSize="14sp" @@ -118,8 +118,8 @@ android:clickable="true" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="4dp" - android:layout_marginEnd="4dp" + android:layout_marginLeft="4dp" + android:layout_marginRight="4dp" android:layout_marginBottom="4dp" android:visibility="gone" app:cardElevation="8dp" @@ -133,9 +133,9 @@ android:layout_width="160dp" android:layout_height="90dp" /> + android:layout_marginLeft="8dp"> + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" /> + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" /> + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" /> + android:layout_marginLeft="2dp" /> @@ -148,9 +148,9 @@ android:id="@+id/create_support_progress" android:layout_width="20dp" android:layout_height="20dp" - android:layout_toStartOf="@id/create_support_send" + android:layout_toLeftOf="@id/create_support_send" android:layout_centerVertical="true" - android:layout_marginEnd="8dp" + android:layout_marginRight="8dp" android:visibility="gone" /> diff --git a/app/src/main/res/layout/dialog_customize_tags.xml b/app/src/main/res/layout/dialog_customize_tags.xml index 2efca530..b19a9ff9 100644 --- a/app/src/main/res/layout/dialog_customize_tags.xml +++ b/app/src/main/res/layout/dialog_customize_tags.xml @@ -8,8 +8,8 @@ android:layout_height="match_parent" android:orientation="vertical"> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" /> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" /> diff --git a/app/src/main/res/layout/dialog_discover.xml b/app/src/main/res/layout/dialog_discover.xml index 77386803..e9a32daf 100644 --- a/app/src/main/res/layout/dialog_discover.xml +++ b/app/src/main/res/layout/dialog_discover.xml @@ -22,7 +22,7 @@ android:id="@+id/discover_loading" android:layout_width="20dp" android:layout_height="20dp" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:visibility="gone" /> @@ -46,8 +46,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" android:fontFamily="@font/inter" android:text="@string/done" /> diff --git a/app/src/main/res/layout/dialog_repost_claim.xml b/app/src/main/res/layout/dialog_repost_claim.xml index ada26944..d35ca589 100644 --- a/app/src/main/res/layout/dialog_repost_claim.xml +++ b/app/src/main/res/layout/dialog_repost_claim.xml @@ -74,7 +74,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:layout_toEndOf="@id/repost_name_prefix" + android:layout_toRightOf="@id/repost_name_prefix" android:fontFamily="@font/inter" android:singleLine="true" android:textSize="14sp" @@ -107,10 +107,10 @@ + android:layout_marginLeft="2dp" /> @@ -165,8 +165,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:layout_marginEnd="24dp" - android:layout_toStartOf="@id/repost_button" + android:layout_marginRight="24dp" + android:layout_toLeftOf="@id/repost_button" android:fontFamily="@font/inter" android:textSize="14sp" android:text="@string/show_advanced" /> @@ -174,9 +174,9 @@ android:id="@+id/repost_progress" android:layout_width="20dp" android:layout_height="20dp" - android:layout_toStartOf="@id/repost_button" + android:layout_toLeftOf="@id/repost_button" android:layout_centerVertical="true" - android:layout_marginEnd="8dp" + android:layout_marginRight="8dp" android:visibility="gone" /> diff --git a/app/src/main/res/layout/exo_playback_control_view.xml b/app/src/main/res/layout/exo_playback_control_view.xml index e5385779..235ae4b1 100644 --- a/app/src/main/res/layout/exo_playback_control_view.xml +++ b/app/src/main/res/layout/exo_playback_control_view.xml @@ -14,7 +14,7 @@ android:layout_centerVertical="true" android:layout_width="72dp" android:layout_height="72dp" - android:layout_toStartOf="@id/player_play_pause"> + android:layout_toLeftOf="@id/player_play_pause"> + android:layout_toRightOf="@id/player_play_pause"> + android:layout_toLeftOf="@id/player_toggle_fullscreen"> + android:layout_alignParentRight="true"> + android:layout_toLeftOf="@id/player_playback_speed" + android:paddingLeft="16dp" + android:paddingRight="4dp"> @@ -19,8 +19,8 @@ android:layout_height="wrap_content" android:paddingTop="8dp" android:paddingBottom="8dp" - android:paddingStart="8dp" - android:paddingEnd="44dp" + android:paddingLeft="8dp" + android:paddingRight="44dp" android:visibility="invisible"> + android:paddingLeft="12dp" + android:paddingRight="16dp"> + android:layout_marginLeft="2dp" /> diff --git a/app/src/main/res/layout/fragment_all_content.xml b/app/src/main/res/layout/fragment_all_content.xml index 35b18a60..b1e8ef79 100644 --- a/app/src/main/res/layout/fragment_all_content.xml +++ b/app/src/main/res/layout/fragment_all_content.xml @@ -25,8 +25,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp"> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp"> + android:layout_alignParentRight="true" /> @@ -85,10 +85,10 @@ @@ -126,10 +126,10 @@ @@ -170,7 +170,7 @@ android:background="?attr/selectableItemBackground" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:clickable="true" android:fontFamily="@font/inter" diff --git a/app/src/main/res/layout/fragment_channel.xml b/app/src/main/res/layout/fragment_channel.xml index 9cd5b5a1..7602a54a 100644 --- a/app/src/main/res/layout/fragment_channel.xml +++ b/app/src/main/res/layout/fragment_channel.xml @@ -19,7 +19,7 @@ + android:layout_marginRight="8dp"> + android:layout_marginRight="8dp"> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp"> @@ -66,15 +66,15 @@ android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="24dp" - android:layout_toEndOf="@id/channel_content_sort_link" + android:layout_marginLeft="24dp" + android:layout_toRightOf="@id/channel_content_sort_link" android:visibility="gone"> diff --git a/app/src/main/res/layout/fragment_channel_form.xml b/app/src/main/res/layout/fragment_channel_form.xml index 6ba62998..4b5630eb 100644 --- a/app/src/main/res/layout/fragment_channel_form.xml +++ b/app/src/main/res/layout/fragment_channel_form.xml @@ -29,7 +29,7 @@ android:background="@drawable/bg_small_icon" android:layout_width="24dp" android:layout_height="24dp" - android:layout_marginStart="16dp" + android:layout_marginLeft="16dp" android:layout_marginBottom="16dp" android:layout_alignParentBottom="true"> @@ -169,7 +169,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="28dp" - android:layout_marginStart="12dp" + android:layout_marginLeft="12dp" android:text="@string/at" android:visibility="gone" /> @@ -195,10 +195,10 @@ + android:layout_marginLeft="2dp" /> @@ -323,8 +323,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:layout_marginEnd="24dp" - android:layout_toStartOf="@id/channel_form_save_button" + android:layout_marginRight="24dp" + android:layout_toLeftOf="@id/channel_form_save_button" android:fontFamily="@font/inter" android:textSize="14sp" android:text="@string/show_optional_fields" /> @@ -333,14 +333,14 @@ android:layout_width="20dp" android:layout_height="20dp" android:layout_centerVertical="true" - android:layout_marginEnd="24dp" - android:layout_toStartOf="@+id/channel_form_save_button" + android:layout_marginRight="24dp" + android:layout_toLeftOf="@+id/channel_form_save_button" android:visibility="gone" /> diff --git a/app/src/main/res/layout/fragment_channel_manager.xml b/app/src/main/res/layout/fragment_channel_manager.xml index 7cd6a948..f53e3429 100644 --- a/app/src/main/res/layout/fragment_channel_manager.xml +++ b/app/src/main/res/layout/fragment_channel_manager.xml @@ -15,9 +15,9 @@ android:id="@+id/channel_manager_list_loading" android:layout_width="20dp" android:layout_height="20dp" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_marginTop="16dp" - android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" android:visibility="gone" /> diff --git a/app/src/main/res/layout/fragment_file_view.xml b/app/src/main/res/layout/fragment_file_view.xml index 2bc6e115..46ad0a64 100644 --- a/app/src/main/res/layout/fragment_file_view.xml +++ b/app/src/main/res/layout/fragment_file_view.xml @@ -19,7 +19,7 @@ + android:paddingLeft="16dp" + android:paddingRight="4dp"> + android:layout_marginRight="48dp"> + android:layout_toLeftOf="@id/file_view_icon_follow"> @@ -559,12 +559,12 @@ android:id="@+id/file_view_icon_unfollow" android:clickable="true" android:background="?attr/selectableItemBackground" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_width="24dp" android:layout_height="24dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" android:text="@string/fa_heart_broken" android:textSize="20dp" android:visibility="invisible" /> @@ -591,8 +591,8 @@ android:autoLink="all" android:textColorLink="@color/lbryGreen" android:textFontWeight="300" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" /> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" /> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp"> @@ -635,8 +635,8 @@ + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp"> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp"> + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp"> + android:layout_alignParentRight="true" /> + android:layout_alignParentRight="true" /> @@ -87,12 +87,12 @@ @@ -118,7 +118,7 @@ android:background="?attr/selectableItemBackground" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:clickable="true" android:fontFamily="@font/inter" @@ -131,8 +131,8 @@ android:id="@+id/following_page_info" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" android:fontFamily="@font/inter" android:textFontWeight="300" android:text="@string/lbry_works_better" @@ -188,8 +188,8 @@ @@ -52,7 +52,7 @@ android:id="@+id/library_list_loading" android:layout_width="20dp" android:layout_height="20dp" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:visibility="gone" /> @@ -190,7 +190,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_centerVertical="true" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:fontFamily="@font/inter" android:text="@string/zero_mb" android:textFontWeight="300" @@ -210,13 +210,13 @@ android:layout_height="10dp" android:layout_centerVertical="true" /> @@ -226,7 +226,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_centerVertical="true" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:fontFamily="@font/inter" android:text="@string/zero_mb" android:textFontWeight="300" @@ -246,13 +246,13 @@ android:layout_height="10dp" android:layout_centerVertical="true" /> @@ -262,7 +262,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_centerVertical="true" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:fontFamily="@font/inter" android:text="@string/zero_mb" android:textFontWeight="300" @@ -282,13 +282,13 @@ android:layout_height="10dp" android:layout_centerVertical="true" /> @@ -298,7 +298,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_centerVertical="true" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:fontFamily="@font/inter" android:text="@string/zero_mb" android:textFontWeight="300" diff --git a/app/src/main/res/layout/fragment_publish.xml b/app/src/main/res/layout/fragment_publish.xml index d474f74a..4c7f637b 100644 --- a/app/src/main/res/layout/fragment_publish.xml +++ b/app/src/main/res/layout/fragment_publish.xml @@ -26,7 +26,7 @@ android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" - android:layout_marginStart="-1.5dp"> + android:layout_marginLeft="-1.5dp"> + android:layout_toRightOf="@id/publish_vertical_divider"> @@ -149,7 +149,7 @@ android:layout_centerVertical="true" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:fontFamily="@font/inter" android:textFontWeight="300" android:textSize="16sp" /> @@ -183,7 +183,7 @@ android:layout_width="20dp" android:layout_height="20dp" android:layout_centerVertical="true" - android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" android:visibility="gone" /> @@ -243,7 +243,7 @@ android:id="@+id/publish_form_loading_channels" android:layout_width="20dp" android:layout_height="20dp" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:visibility="gone" /> @@ -280,7 +280,7 @@ android:id="@+id/publish_form_price_switch" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" /> @@ -318,8 +318,8 @@ android:entries="@array/publish_currencies" android:layout_width="110dp" android:layout_height="wrap_content" - android:layout_toEndOf="@+id/publish_form_price_layout" - android:layout_marginStart="4dp" + android:layout_toRightOf="@+id/publish_form_price_layout" + android:layout_marginLeft="4dp" android:layout_marginTop="24dp" /> @@ -349,7 +349,7 @@ android:id="@+id/publish_form_generate_address" android:background="?attr/selectableItemBackground" android:clickable="true" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -416,10 +416,10 @@ + android:layout_marginLeft="2dp" /> @@ -538,7 +538,7 @@ android:layout_height="wrap_content" android:layout_gravity="end" android:layout_marginTop="24dp" - android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" android:fontFamily="@font/inter" android:text="@string/show_extra_fields" android:textFontWeight="300" /> @@ -546,8 +546,8 @@ diff --git a/app/src/main/res/layout/fragment_publishes.xml b/app/src/main/res/layout/fragment_publishes.xml index 9168ccc2..ce375030 100644 --- a/app/src/main/res/layout/fragment_publishes.xml +++ b/app/src/main/res/layout/fragment_publishes.xml @@ -15,9 +15,9 @@ android:id="@+id/publishes_list_loading" android:layout_width="20dp" android:layout_height="20dp" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_marginTop="16dp" - android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" android:visibility="gone" /> diff --git a/app/src/main/res/layout/fragment_rewards.xml b/app/src/main/res/layout/fragment_rewards.xml index 9d9e82ef..46838086 100644 --- a/app/src/main/res/layout/fragment_rewards.xml +++ b/app/src/main/res/layout/fragment_rewards.xml @@ -8,8 +8,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="16dp" - android:paddingStart="16dp" - android:paddingEnd="16dp"> + android:paddingLeft="16dp" + android:paddingRight="16dp"> @@ -44,7 +44,7 @@ android:id="@+id/rewards_list_loading" android:layout_width="20dp" android:layout_height="20dp" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:visibility="gone" /> @@ -87,7 +87,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:layout_marginStart="8dp" + android:layout_marginLeft="8dp" android:fontFamily="@font/inter" android:textSize="24sp" android:textColor="@color/white" /> @@ -143,7 +143,7 @@ diff --git a/app/src/main/res/layout/fragment_transaction_history.xml b/app/src/main/res/layout/fragment_transaction_history.xml index 0c545eac..2762311d 100644 --- a/app/src/main/res/layout/fragment_transaction_history.xml +++ b/app/src/main/res/layout/fragment_transaction_history.xml @@ -9,8 +9,8 @@ android:id="@+id/transaction_history_no_transactions" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" android:fontFamily="@font/inter" android:textSize="14sp" android:text="@string/no_transactions" diff --git a/app/src/main/res/layout/fragment_verification_phone.xml b/app/src/main/res/layout/fragment_verification_phone.xml index 266de2b5..d517ba5e 100644 --- a/app/src/main/res/layout/fragment_verification_phone.xml +++ b/app/src/main/res/layout/fragment_verification_phone.xml @@ -136,8 +136,8 @@ android:id="@+id/verification_phone_verify_progress" android:layout_width="24dp" android:layout_height="24dp" - android:layout_toEndOf="@id/verification_phone_verify_button" - android:layout_marginStart="16dp" + android:layout_toRightOf="@id/verification_phone_verify_button" + android:layout_marginLeft="16dp" android:layout_centerVertical="true" android:visibility="gone" /> @@ -149,7 +149,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:fontFamily="@font/inter" android:text="@string/edit" android:textColor="@color/white" diff --git a/app/src/main/res/layout/fragment_verification_wallet.xml b/app/src/main/res/layout/fragment_verification_wallet.xml index 0c6d6eff..dbed136c 100644 --- a/app/src/main/res/layout/fragment_verification_wallet.xml +++ b/app/src/main/res/layout/fragment_verification_wallet.xml @@ -33,7 +33,7 @@ android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginTop="24dp" /> diff --git a/app/src/main/res/layout/fragment_wallet.xml b/app/src/main/res/layout/fragment_wallet.xml index 4b0fff98..762e2866 100644 --- a/app/src/main/res/layout/fragment_wallet.xml +++ b/app/src/main/res/layout/fragment_wallet.xml @@ -95,7 +95,7 @@ @@ -128,8 +128,8 @@ android:layout_height="wrap_content" android:orientation="vertical" android:layout_centerVertical="true" - android:layout_marginStart="16dp" - android:layout_toEndOf="@id/claim_media_container"> + android:layout_marginLeft="16dp" + android:layout_toRightOf="@id/claim_media_container"> + android:layout_marginRight="2dp"> + android:layout_marginLeft="16dp" + android:layout_toRightOf="@id/claim_media_container"> diff --git a/app/src/main/res/layout/list_item_stream.xml b/app/src/main/res/layout/list_item_stream.xml index be24eeae..6e73ec64 100644 --- a/app/src/main/res/layout/list_item_stream.xml +++ b/app/src/main/res/layout/list_item_stream.xml @@ -3,8 +3,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingStart="16dp" - android:paddingEnd="16dp" + android:paddingLeft="16dp" + android:paddingRight="16dp" android:paddingTop="8dp" android:paddingBottom="8dp" android:clickable="true" @@ -32,7 +32,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:layout_marginStart="4dp" + android:layout_marginLeft="4dp" android:fontFamily="@font/inter" android:textColor="@color/lightForeground" android:textFontWeight="300" @@ -41,7 +41,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:layout_marginStart="4dp" + android:layout_marginLeft="4dp" android:fontFamily="@font/inter" android:text="@string/reposted" android:textColor="@color/lightForeground" @@ -83,8 +83,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:layout_alignParentEnd="true" - android:layout_marginEnd="4dp" + android:layout_alignParentRight="true" + android:layout_marginRight="4dp" android:layout_marginBottom="4dp" android:fontFamily="@font/inter" android:textColor="@android:color/white" @@ -98,13 +98,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" - android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" android:layout_marginTop="4dp" - android:layout_marginEnd="4dp" + android:layout_marginRight="4dp" android:paddingTop="2dp" android:paddingBottom="2dp" - android:paddingStart="6dp" - android:paddingEnd="7dp" + android:paddingLeft="6dp" + android:paddingRight="7dp" android:visibility="gone"> + android:layout_marginLeft="16dp" + android:layout_toRightOf="@id/claim_media_container"> diff --git a/app/src/main/res/layout/list_item_suggested_channel.xml b/app/src/main/res/layout/list_item_suggested_channel.xml index 49ebf048..9c461b53 100644 --- a/app/src/main/res/layout/list_item_suggested_channel.xml +++ b/app/src/main/res/layout/list_item_suggested_channel.xml @@ -10,8 +10,8 @@ android:focusable="true" android:paddingTop="12dp" android:paddingBottom="12dp" - android:paddingStart="8dp" - android:paddingEnd="8dp"> + android:paddingLeft="8dp" + android:paddingRight="8dp"> + android:paddingLeft="8dp" + android:paddingRight="8dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/list_item_tag.xml b/app/src/main/res/layout/list_item_tag.xml index f37e1d6c..9881babe 100644 --- a/app/src/main/res/layout/list_item_tag.xml +++ b/app/src/main/res/layout/list_item_tag.xml @@ -5,19 +5,19 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="6dp" - android:layout_marginEnd="6dp" + android:layout_marginRight="6dp" android:orientation="horizontal" android:paddingTop="4dp" android:paddingBottom="4dp" - android:paddingStart="8dp" - android:paddingEnd="12dp" + android:paddingLeft="8dp" + android:paddingRight="12dp" android:foreground="?attr/selectableItemBackground"> \ No newline at end of file diff --git a/app/src/main/res/layout/list_item_url_suggestion.xml b/app/src/main/res/layout/list_item_url_suggestion.xml index 2be0703e..335c865e 100644 --- a/app/src/main/res/layout/list_item_url_suggestion.xml +++ b/app/src/main/res/layout/list_item_url_suggestion.xml @@ -2,8 +2,8 @@ \ No newline at end of file diff --git a/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java b/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java new file mode 100644 index 00000000..36ce5b49 --- /dev/null +++ b/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java @@ -0,0 +1,130 @@ +package io.lbry.browser.utils; + +import org.jetbrains.annotations.NotNull; +import org.junit.Before; +import org.junit.Test; + +import io.lbry.browser.exceptions.LbryUriException; + +import static org.junit.Assert.assertEquals; + +public class LbryUriTest { + private LbryUri expected; + + /* + * Create an LbryUri object and assign fields manually using class methods. This object will be + * compared with LbryUri.parse() returned object on each test. + */ + @Before + public void createExpected() { + expected = new LbryUri(); + expected.setChannelName("@lbry"); + expected.setStreamName("lbryturns4"); + + try { + LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse("#", "3f"); + LbryUri.UriModifier secondaryMod = LbryUri.UriModifier.parse("#", "6"); + expected.setChannelClaimId(primaryMod.getClaimId()); + expected.setStreamClaimId(secondaryMod.getClaimId()); + } catch (LbryUriException e) { + e.printStackTrace(); + } + } + + @Test + public void parseOpenLbryComWithChannel() { + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("https://open.lbry.com/@lbry:3f/lbryturns4:6",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals(expected, obtained); + } + + @Test + public void parseLbryTvWithChannel() { + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("https://lbry.tv/@lbry:3f/lbryturns4:6",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals(expected, obtained); + } + + @Test + public void parseLbryAlterWithChannel() { + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("https://lbry.lat/@lbry:3f/lbryturns4:6",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals(expected, obtained); + } + + @Test + public void parseLbryProtocolWithChannel() { + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("lbry://@lbry#3f/lbryturns4#6",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals(expected, obtained); + } + + @Test + public void parseLbryProtocolOnlyChannel() { + LbryUri expectedForChannel = sinthesizeExpected(); + + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("lbry://@UCBerkeley#d",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals(expectedForChannel, obtained); + } + + @Test + public void parseLbryTvProtocolOnlyChannel() { + LbryUri expectedForChannel = sinthesizeExpected(); + + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("https://lbry.tv/@UCBerkeley:d",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals(expectedForChannel, obtained); + } + + @NotNull + private LbryUri sinthesizeExpected() { + LbryUri expectedForChannel = new LbryUri(); + expectedForChannel.setChannelName("@UCBerkeley"); + expectedForChannel.setChannel(true); + + try { + LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse("#", "d"); + expectedForChannel.setChannelClaimId(primaryMod.getClaimId()); + } catch (LbryUriException e) { + e.printStackTrace(); + } + return expectedForChannel; + } +} \ No newline at end of file