set banner as default toolbar image
This commit is contained in:
parent
5af23c1962
commit
98ab900b3d
|
@ -30,7 +30,7 @@ dependencies {
|
|||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.0'
|
||||
implementation 'androidx.navigation:navigation-ui:2.3.0'
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.content.Intent;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -66,6 +67,28 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
ok_button.setEnabled(false);
|
||||
|
||||
toolbar_image_view.setImageResource(R.drawable.ic_banner_foreground);
|
||||
|
||||
AppBarLayout app_bar_layout = (AppBarLayout) findViewById(R.id.app_bar);
|
||||
app_bar_layout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
||||
boolean isShow = true;
|
||||
int scrollRange = -1;
|
||||
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
||||
if (scrollRange == -1) {
|
||||
scrollRange = appBarLayout.getTotalScrollRange();
|
||||
}
|
||||
if (scrollRange + verticalOffset == 0) {
|
||||
toolbar_layout.setTitle(getString(R.string.app_name));
|
||||
isShow = true;
|
||||
} else if(isShow) {
|
||||
toolbar_layout.setTitle(" ");
|
||||
isShow = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
paste_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
@ -259,14 +282,13 @@ public class MainActivity extends AppCompatActivity {
|
|||
field_event_description.setError(null);
|
||||
toolbar_image_view.setImageDrawable(null);
|
||||
|
||||
toolbar_layout.setTitle(getString(R.string.app_name));
|
||||
|
||||
if (scraper!=null)
|
||||
{
|
||||
scraper.cancel(true);
|
||||
scraper = null;
|
||||
}
|
||||
ok_button.setEnabled(false);
|
||||
toolbar_image_view.setImageResource(R.drawable.ic_banner_foreground);
|
||||
}
|
||||
|
||||
public void update(FbEvent event) {
|
||||
|
@ -306,7 +328,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
try {
|
||||
Picasso.get().load(event.image_url).into(toolbar_image_view);
|
||||
toolbar_layout.setTitle(" ");
|
||||
} catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="642dp"
|
||||
android:height="642dp"
|
||||
android:viewportWidth="642"
|
||||
android:viewportHeight="642">
|
||||
<path
|
||||
android:pathData="M0.5,0.5h640v640h-640z"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M0.5,120.5h640v410h-640z"
|
||||
android:fillColor="#297da6"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M6.5,40.5L634.5,40.5A6,6 0,0 1,640.5 46.5L640.5,134.5A6,6 0,0 1,634.5 140.5L6.5,140.5A6,6 0,0 1,0.5 134.5L0.5,46.5A6,6 0,0 1,6.5 40.5z"
|
||||
android:fillColor="#74b42b"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M519.5,0.5L561.5,0.5A9,9 0,0 1,570.5 9.5L570.5,101.5A9,9 0,0 1,561.5 110.5L519.5,110.5A9,9 0,0 1,510.5 101.5L510.5,9.5A9,9 0,0 1,519.5 0.5z"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M399.5,0.5L441.5,0.5A9,9 0,0 1,450.5 9.5L450.5,101.5A9,9 0,0 1,441.5 110.5L399.5,110.5A9,9 0,0 1,390.5 101.5L390.5,9.5A9,9 0,0 1,399.5 0.5z"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M199.5,0.5L241.5,0.5A9,9 0,0 1,250.5 9.5L250.5,101.5A9,9 0,0 1,241.5 110.5L199.5,110.5A9,9 0,0 1,190.5 101.5L190.5,9.5A9,9 0,0 1,199.5 0.5z"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M79.5,0.5L121.5,0.5A9,9 0,0 1,130.5 9.5L130.5,101.5A9,9 0,0 1,121.5 110.5L79.5,110.5A9,9 0,0 1,70.5 101.5L70.5,9.5A9,9 0,0 1,79.5 0.5z"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M526.5,10.5L554.5,10.5A6,6 0,0 1,560.5 16.5L560.5,94.5A6,6 0,0 1,554.5 100.5L526.5,100.5A6,6 0,0 1,520.5 94.5L520.5,16.5A6,6 0,0 1,526.5 10.5z"
|
||||
android:fillColor="#42a3d2"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M406.5,10.5L434.5,10.5A6,6 0,0 1,440.5 16.5L440.5,94.5A6,6 0,0 1,434.5 100.5L406.5,100.5A6,6 0,0 1,400.5 94.5L400.5,16.5A6,6 0,0 1,406.5 10.5z"
|
||||
android:fillColor="#42a3d2"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M86.5,10.5L114.5,10.5A6,6 0,0 1,120.5 16.5L120.5,94.5A6,6 0,0 1,114.5 100.5L86.5,100.5A6,6 0,0 1,80.5 94.5L80.5,16.5A6,6 0,0 1,86.5 10.5z"
|
||||
android:fillColor="#42a3d2"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M206.5,10.5L234.5,10.5A6,6 0,0 1,240.5 16.5L240.5,94.5A6,6 0,0 1,234.5 100.5L206.5,100.5A6,6 0,0 1,200.5 94.5L200.5,16.5A6,6 0,0 1,206.5 10.5z"
|
||||
android:fillColor="#42a3d2"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M9.5,490.5L631.5,490.5A9,9 0,0 1,640.5 499.5L640.5,631.5A9,9 0,0 1,631.5 640.5L9.5,640.5A9,9 0,0 1,0.5 631.5L0.5,499.5A9,9 0,0 1,9.5 490.5z"
|
||||
android:fillColor="#297da6"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M155.5,295.5L281.94,295.5L320.5,174.5L359.06,295.5L485.5,295.5L384.76,376.53L424.71,504.5L320.5,425.3L216.29,504.5L256.24,376.53Z"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#00000000"/>
|
||||
</vector>
|
Loading…
Reference in New Issue