This file contains hidden or 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
public class AlertDialogHelper { | |
private static void displayAlertDialog(Context context, String title, String body, DialogAction... actions) { | |
LayoutInflater inflater = LayoutInflater.from(context); | |
final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1); | |
final View inflatedLayout = inflater.inflate(R.layout.custom_alert_dialog, null); | |
final AlertDialog dialog = new AlertDialog.Builder(context).create(); | |
dialog.setView(inflatedLayout); | |
((TextView)inflatedLayout.findViewById(R.id.title)).setText(title); | |
((TextView)inflatedLayout.findViewById(R.id.body)).setText(body); |
This file contains hidden or 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
public class LanguageHelper { | |
public static void updateLanguage(Context ctx) { | |
String lang = PreferenceManager.getDefaultSharedPreferences(ctx).getString("locale", ""); | |
updateLanguage(ctx, lang); | |
} | |
public static void updateLanguage(Context context, int language) { | |
updateLanguage(context, getLocaleById(language)); | |
} |
This file contains hidden or 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
public class BaseActivity extends Activity { | |
@Override | |
protected void onResume() { | |
super.onResume(); | |
MusicHelper.getInstance(this).setMovingInApp(false); | |
} | |
@Override | |
public void onPause() { | |
super.onPause(); |
This file contains hidden or 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
@Override | |
protected void onResume() { | |
super.onResume(); | |
//noinspection ResourceType | |
setRequestedOrientation(Setting.get(Enums.Setting.Orientation).getIntValue()); | |
} |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.yourpackagename"> | |
<application | |
android:name=".MainApplication" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name"> | |
<meta-data | |
android:name="DATABASE" |
This file contains hidden or 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
<application | |
android:allowBackup="true" | |
android:fullBackupContent="@xml/backup_rules" |
This file contains hidden or 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
import android.content.Context | |
import android.support.v4.view.ViewPager | |
import android.util.AttributeSet | |
import android.view.MotionEvent | |
enum class SwipeDirection { BOTH, LEFT, RIGHT, NONE } | |
// https://stackoverflow.com/a/34076649/608312 | |
class LockableViewPager(context: Context, attrs: AttributeSet) : ViewPager(context, attrs) { |
This file contains hidden or 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
<style name="Font_Regular" tools:keep="@style/Font_Regular"> | |
<item name="android:fontFamily">@font/the_sans_c4s</item> | |
</style> | |
<style name="Font_Regular_Italic" parent="Font_Regular" tools:keep="@style/Font_Regular_Italic"> | |
<item name="android:textStyle">italic</item> | |
</style> | |
<style name="Font_Bold" parent="Font_Regular" tools:keep="@style/Font_Bold"> | |
<item name="android:textStyle">bold</item> |
This file contains hidden or 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
// Changing colour | |
val layerDrawable = (ImageView)findViewById(R.id.my_drawable).drawable as LayerDrawable | |
val backgroundDrawable = layerDrawable.findDrawableByLayerId(R.id.background_circle) as GradientDrawable | |
backgroundDrawable.setColor(ContextCompat.getColor(context, R.color.my_colour)) | |
// Changing drawable | |
layerDrawable.setDrawableByLayerId(R.id.foreground_icon, ContextCompat.getDrawable(context, R.drawable.new_foreground_icon)) |
This file contains hidden or 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
interface ActionHandler { | |
fun handleAction(actionCode: String) | |
} |