1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 06:11:19 +00:00

Improve visual hover indication on Android TVs (#246)

* Add drawables: menu white, black; settings_black (fixes #243) (fixes #244)

* Add drawable: button arrow_back

* Add button desc strings: open/close menu

* WIP: Try to fix issue #244

* WIP: Try to fix issue #244 (2)

* WIP: Try to fix issue #244 (3)

* Fix lint

* Add visual indication when hovering share icon in "Show Device ID" dialog (fixes #242)

* Updated de translation
This commit is contained in:
Catfriend1 2019-01-19 22:23:27 +00:00 committed by GitHub
parent 46f49a4dd7
commit d16ba49416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 56 additions and 5 deletions

View file

@ -25,11 +25,13 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.Toolbar;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
@ -364,6 +366,17 @@ public class MainActivity extends SyncthingActivity
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
toolbar.setNavigationIcon(R.drawable.btn_menu);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mDrawerLayout.openDrawer(Gravity.START);
}
});
}
mDrawerToggle.syncState();
ActionBar actionBar = getSupportActionBar();
@ -426,7 +439,8 @@ public class MainActivity extends SyncthingActivity
*/
private class Toggle extends ActionBarDrawerToggle {
public Toggle(Activity activity, DrawerLayout drawerLayout) {
super(activity, drawerLayout, R.string.app_name, R.string.app_name);
super(activity, drawerLayout, R.string.open_main_menu, R.string.close_main_menu);
setDrawerIndicatorEnabled(false);
}
@Override

View file

@ -7,6 +7,7 @@ import android.content.ServiceConnection;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
// import android.util.Log;
@ -41,13 +42,16 @@ public abstract class SyncthingActivity extends AppCompatActivity implements Ser
return;
}
toolbar.setNavigationContentDescription(R.string.main_menu);
toolbar.setNavigationIcon(R.drawable.btn_arrow_back);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
toolbar.setTouchscreenBlocksFocus(false);
}
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.btn_arrow_back);
}
}
@Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/ic_arrow_back_black_24" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ic_arrow_back_white_24" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ic_arrow_back_white_24"/>
<item android:drawable="@drawable/ic_arrow_back_white_24" />
</selector>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/ic_menu_black_24" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ic_menu_white_24" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ic_menu_white_24"/>
<item android:drawable="@drawable/ic_menu_white_24" />
</selector>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/ic_settings_black_24" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ic_settings_white_24dp" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ic_settings_white_24dp"/>
<item android:drawable="@drawable/ic_settings_white_24dp" />
</selector>

View file

@ -33,6 +33,7 @@
<TextView
android:id="@+id/actionShareId"
style="@style/Widget.Syncthing.TextView.Label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View file

@ -5,7 +5,7 @@
<item
android:id="@+id/open_preferences"
android:icon="@drawable/ic_settings_white_24dp"
android:icon="@drawable/btn_settings"
android:title="@string/settings_title"
app:showAsAction="always|withText" />

View file

@ -59,6 +59,10 @@ Bitte melden Sie auftretende Probleme via GitHub.</string>
<!-- Main menu button -->
<string name="open_main_menu">Öffne Hauptmenü</string>
<string name="close_main_menu">Schließe Hauptmenü</string>
<!-- Exception dialog message -->
<string name="exception_known_bug_notice">Ein bekannter Fehler, der noch nicht behoben wurde, ist aufgetreten. Mehr Details dazu unter %1$s/%2$s. Bitte hinterlasse uns eine genaue Beschreibung dessen, was vorher passiert ist.</string>

View file

@ -59,6 +59,10 @@ Please report any problems you encounter via Github.</string>
<!-- Main menu button -->
<string name="open_main_menu">Open Main Menu</string>
<string name="close_main_menu">Close Main Menu</string>
<!-- Exception dialog message -->
<string name="exception_known_bug_notice">A known bug that has not been solved yet has been encountered. See %1$s/%2$s for more information. Please leave us a precise description of what happened beforehand.</string>