-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from binhbt/support_implement_for_activity_frag…
…ment Support implement for activity fragment
- Loading branch information
Showing
37 changed files
with
1,058 additions
and
295 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/androiddeft/recyclerviewdemo/ActivityScaleActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.androiddeft.recyclerviewdemo; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.webkit.WebView; | ||
import android.widget.TextView; | ||
|
||
import com.androiddeft.recyclerviewdemo.font.FontHelper; | ||
import com.leo.font.lib.annotations.AutoScale; | ||
import com.leo.font.lib.binder.FontBinding; | ||
import com.vn.fa.font.FontManager; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
@AutoScale | ||
public class ActivityScaleActivity extends AppCompatActivity { | ||
TextView tvGreeting1; | ||
TextView tvGreeting2; | ||
WebView webView; | ||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_test); | ||
FontManager.getDefault().setScale(1); | ||
tvGreeting1 = (TextView) findViewById(R.id.tv_greeting1); | ||
tvGreeting2 = (TextView) findViewById(R.id.tv_greeting2); | ||
webView = findViewById(R.id.webView); | ||
FontBinding.bind(this); | ||
webView.loadUrl("https://github.com/binhbt/FaFontAutoScale"); | ||
|
||
} | ||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu.main_menu, menu); | ||
return super.onCreateOptionsMenu(menu); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()){ | ||
case R.id.font_small: | ||
FontHelper.scaleFont(this, 0); | ||
break; | ||
case R.id.font_big: | ||
FontHelper.scaleFont(this, 1); | ||
|
||
break; | ||
case R.id.font_huge: | ||
FontHelper.scaleFont(this, 2); | ||
break; | ||
} | ||
FontBinding.bind(this); | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
app/src/main/java/com/androiddeft/recyclerviewdemo/FragmentDemo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.androiddeft.recyclerviewdemo; | ||
|
||
import android.app.Fragment; | ||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.webkit.WebView; | ||
import android.widget.TextView; | ||
|
||
import com.leo.font.lib.annotations.AutoScale; | ||
import com.leo.font.lib.binder.FontBinding; | ||
import com.vn.fa.font.FontManager; | ||
|
||
@AutoScale | ||
public class FragmentDemo extends Fragment{ | ||
TextView tvGreeting1; | ||
TextView tvGreeting2; | ||
WebView webView; | ||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { | ||
View v = inflater.inflate(R.layout.activity_test, container, false); | ||
FontManager.getDefault().setScale(1); | ||
tvGreeting1 = (TextView) v.findViewById(R.id.tv_greeting1); | ||
tvGreeting2 = (TextView) v.findViewById(R.id.tv_greeting2); | ||
webView = v.findViewById(R.id.webView); | ||
webView.loadUrl("https://github.com/binhbt/FaFontAutoScale"); | ||
return v; | ||
|
||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
((FragmentScaleDemoActivity)getActivity()).setListener(new FragmentScaleDemoActivity.OnFontChangeListener() { | ||
@Override | ||
public void doChange() { | ||
FontBinding.bind(FragmentDemo.this); | ||
} | ||
}); | ||
FontBinding.bind(this); | ||
|
||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/androiddeft/recyclerviewdemo/FragmentScaleDemoActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.androiddeft.recyclerviewdemo; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.webkit.WebView; | ||
import android.widget.TextView; | ||
|
||
import com.androiddeft.recyclerviewdemo.font.FontHelper; | ||
import com.leo.font.lib.binder.FontBinding; | ||
import com.vn.fa.font.FontManager; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
public class FragmentScaleDemoActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_fragment_est); | ||
} | ||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu.main_menu, menu); | ||
return super.onCreateOptionsMenu(menu); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()){ | ||
case R.id.font_small: | ||
FontHelper.scaleFont(this, 0); | ||
break; | ||
case R.id.font_big: | ||
FontHelper.scaleFont(this, 1); | ||
|
||
break; | ||
case R.id.font_huge: | ||
FontHelper.scaleFont(this, 2); | ||
break; | ||
} | ||
if (listener != null){ | ||
listener.doChange(); | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
public interface OnFontChangeListener{ | ||
void doChange(); | ||
} | ||
private OnFontChangeListener listener; | ||
|
||
public OnFontChangeListener getListener() { | ||
return listener; | ||
} | ||
|
||
public void setListener(OnFontChangeListener listener) { | ||
this.listener = listener; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
<fragment | ||
android:id="@+id/fragment_test" | ||
android:name="com.androiddeft.recyclerviewdemo.FragmentDemo" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"/> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<resources> | ||
<string name="app_name">Top 10 Hollywood Movies</string> | ||
<string name="app_name">Font Auto Scale Demo</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.