mirror of
https://github.com/gsantner/dandelion
synced 2024-11-22 04:12:08 +01:00
AboutActivity respects intellihide settings, all coordinatorlayouts do now snap, added back button to AboutActivity and SettingsActivity
This commit is contained in:
parent
315361e2b2
commit
823ab7b8d8
6 changed files with 42 additions and 22 deletions
|
@ -18,13 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package com.github.dfa.diaspora_android.activity;
|
package com.github.dfa.diaspora_android.activity;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.design.widget.AppBarLayout;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
@ -32,10 +30,10 @@ import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.App;
|
import com.github.dfa.diaspora_android.App;
|
||||||
|
@ -55,17 +53,18 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
|
|
||||||
|
@BindView(R.id.toolbar)
|
||||||
|
protected Toolbar toolbar;
|
||||||
|
|
||||||
|
@BindView(R.id.linearlayout)
|
||||||
|
protected LinearLayout linearLayout;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_about);
|
setContentView(R.layout.activity_about);
|
||||||
registerReceiver(new BroadcastReceiver() {
|
ButterKnife.bind(this);
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
Log.d("INTREC", intent.toString());
|
|
||||||
}
|
|
||||||
}, new IntentFilter(Intent.ACTION_VIEW));
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
|
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
|
||||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -84,6 +83,12 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
|
|
||||||
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
|
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
|
||||||
tabLayout.setupWithViewPager(mViewPager);
|
tabLayout.setupWithViewPager(mViewPager);
|
||||||
|
|
||||||
|
//Apply intellihide
|
||||||
|
if(!((App)getApplication()).getSettings().isIntellihideToolbars()) {
|
||||||
|
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
|
||||||
|
params.setScrollFlags(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,22 +29,44 @@ import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.App;
|
import com.github.dfa.diaspora_android.App;
|
||||||
import com.github.dfa.diaspora_android.R;
|
import com.github.dfa.diaspora_android.R;
|
||||||
|
|
||||||
|
import butterknife.OnEditorAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author vanitas
|
* @author vanitas
|
||||||
*/
|
*/
|
||||||
public class SettingsActivity extends PreferenceActivity {
|
public class SettingsActivity extends AppCompatActivity {
|
||||||
private boolean activityRestartRequired;
|
private boolean activityRestartRequired;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
ActionBar toolbar = getSupportActionBar();
|
||||||
|
if(toolbar != null)
|
||||||
|
toolbar.setDisplayHomeAsUpEnabled(true);
|
||||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
|
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem menuItem)
|
||||||
|
{
|
||||||
|
switch (menuItem.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
onBackPressed();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(menuItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setActivityRestartRequired() {
|
private void setActivityRestartRequired() {
|
||||||
this.activityRestartRequired = true;
|
this.activityRestartRequired = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,10 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/linearlayout"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:layout_scrollFlags="scroll|enterAlways"
|
app:layout_scrollFlags="scroll|enterAlways|snap"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:layout_scrollFlags="scroll|enterAlways"
|
app:layout_scrollFlags="scroll|enterAlways|snap"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_centerVertical="true" />
|
android:layout_centerVertical="true" />
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_toEndOf="@+id/textView"
|
android:layout_toEndOf="@+id/textView"
|
||||||
android:layout_toLeftOf="@+id/podselection__button_select_pod"
|
|
||||||
android:layout_toStartOf="@+id/podselection__button_select_pod"
|
android:layout_toStartOf="@+id/podselection__button_select_pod"
|
||||||
android:layout_toRightOf="@+id/textView"
|
|
||||||
android:hint="@string/filter_hint"
|
android:hint="@string/filter_hint"
|
||||||
android:inputType="textUri|textWebEditText" />
|
android:inputType="textUri|textWebEditText" />
|
||||||
|
|
||||||
|
@ -57,7 +55,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_above="@+id/podselection__listpods"
|
android:layout_above="@+id/podselection__listpods"
|
||||||
android:layout_alignEnd="@+id/podselection__listpods"
|
android:layout_alignEnd="@+id/podselection__listpods"
|
||||||
android:layout_alignRight="@+id/podselection__listpods"
|
|
||||||
android:layout_alignTop="@+id/podselection__edit_filter"
|
android:layout_alignTop="@+id/podselection__edit_filter"
|
||||||
android:contentDescription="@string/confirm_url"
|
android:contentDescription="@string/confirm_url"
|
||||||
android:paddingLeft="5dp"
|
android:paddingLeft="5dp"
|
||||||
|
@ -69,7 +66,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:autoLink="web"
|
android:autoLink="web"
|
||||||
android:text="@string/podlist_source_note"
|
android:text="@string/podlist_source_note"
|
||||||
|
@ -80,11 +76,9 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_above="@+id/podselection__listpods"
|
android:layout_above="@+id/podselection__listpods"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:layout_marginRight="0dp"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/prefix_https"
|
android:text="@string/prefix_https"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
Loading…
Reference in a new issue