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
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_arrow_back_black_24.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
app/src/main/res/drawable-hdpi/ic_arrow_back_white_24.png
Normal file
After Width: | Height: | Size: 171 B |
BIN
app/src/main/res/drawable-hdpi/ic_menu_black_24.png
Normal file
After Width: | Height: | Size: 100 B |
BIN
app/src/main/res/drawable-hdpi/ic_menu_white_24.png
Normal file
After Width: | Height: | Size: 92 B |
BIN
app/src/main/res/drawable-hdpi/ic_settings_black_24.png
Normal file
After Width: | Height: | Size: 424 B |
BIN
app/src/main/res/drawable-mdpi/ic_arrow_back_black_24.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
app/src/main/res/drawable-mdpi/ic_arrow_back_white_24.png
Normal file
After Width: | Height: | Size: 132 B |
BIN
app/src/main/res/drawable-mdpi/ic_menu_black_24.png
Normal file
After Width: | Height: | Size: 88 B |
BIN
app/src/main/res/drawable-mdpi/ic_menu_white_24.png
Normal file
After Width: | Height: | Size: 90 B |
BIN
app/src/main/res/drawable-mdpi/ic_settings_black_24.png
Normal file
After Width: | Height: | Size: 305 B |
BIN
app/src/main/res/drawable-xhdpi/ic_arrow_back_black_24.png
Normal file
After Width: | Height: | Size: 170 B |
BIN
app/src/main/res/drawable-xhdpi/ic_arrow_back_white_24.png
Normal file
After Width: | Height: | Size: 170 B |
BIN
app/src/main/res/drawable-xhdpi/ic_menu_black_24.png
Normal file
After Width: | Height: | Size: 108 B |
BIN
app/src/main/res/drawable-xhdpi/ic_menu_white_24.png
Normal file
After Width: | Height: | Size: 93 B |
BIN
app/src/main/res/drawable-xhdpi/ic_settings_black_24.png
Normal file
After Width: | Height: | Size: 541 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_arrow_back_black_24.png
Normal file
After Width: | Height: | Size: 202 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_menu_black_24.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_menu_white_24.png
Normal file
After Width: | Height: | Size: 93 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_settings_black_24.png
Normal file
After Width: | Height: | Size: 745 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_arrow_back_black_24.png
Normal file
After Width: | Height: | Size: 262 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_arrow_back_white_24.png
Normal file
After Width: | Height: | Size: 261 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_menu_black_24.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_menu_white_24.png
Normal file
After Width: | Height: | Size: 99 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_settings_black_24.png
Normal file
After Width: | Height: | Size: 1 KiB |
8
app/src/main/res/drawable/btn_arrow_back.xml
Normal 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>
|
8
app/src/main/res/drawable/btn_menu.xml
Normal 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>
|
8
app/src/main/res/drawable/btn_settings.xml
Normal 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>
|
|
@ -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"
|
||||
|
|
|
@ -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" />
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|