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
/** | |
* Dialog Fragment with hide animations | |
*/ | |
class AnimatingDialogFragment : DialogFragment() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setStyle(DialogFragment.STYLE_NO_FRAME, R.style.TvTheme_Dialog) | |
} |
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
@file:Suppress("PackageDirectoryMismatch") | |
package android.support.v17.leanback.widget | |
import android.os.Handler | |
import android.os.Looper | |
import android.view.View | |
import java.lang.ref.WeakReference | |
/** |
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
abstract class BaseGridFragment : Fragment() { | |
private var lifecycleCallbacks: FragmentManager.FragmentLifecycleCallbacks? = null | |
/** | |
* If your fragment contains a VerticalGridSupportFragment, it automatically includes a search button you can disable. | |
* However, the focus search listener is not disabled, and it does conflict with our implementation for showing the menu. | |
* Don't forget to save a reference to the callbacks to unsubscribe when destroying the fragment. | |
*/ | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
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
@file:Suppress("PackageDirectoryMismatch") | |
package android.support.v17.leanback.widget | |
import android.os.Bundle | |
import android.support.v17.leanback.app.RowsSupportFragment | |
import android.support.v7.widget.RecyclerView | |
import android.view.View | |
/** | |
* RowsSupportFragment which also remembers the subposition in the rows. |
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
for (int j = start_index; j < end_index; j++) { | |
float value = get_element(tableau, tableau->rows - 1, j); | |
rsSetElementAt_float(solution_vector, value, j - start_index); | |
} | |
rsSetElementAt_int(result_size, end_index - start_index, 0); |
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
#define DEBUG true | |
#if DEBUG | |
#define LOG(msg, param) rsDebug(msg, param) | |
#else | |
#define LOG(msg, param) | |
#endif |
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
#pragma version(1) | |
#pragma rs java_package_name(com.egeniq.lpsolver.renderscript) | |
#pragma rs_fp_full | |
#include "simplex.rsh" |
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
Type solutionVectorType = new Type.Builder(renderScript, Element.F32(renderScript)).setX(script.get_MAX_COLS()).create(); | |
Type resultSizeType = new Type.Builder(renderScript, Element.I32(renderScript)).create(); | |
script.set_solution_vector(arrayAllocation); | |
script.set_result_size(resultSizeAllocation); | |
script.invoke_solve(); | |
float[] solutionVector = new float[script.get_MAX_COLS()]; | |
arrayAllocation.copyTo(solutionVector); | |
int[] resultSizeVector = new int[1]; | |
resultSizeAllocation.copyTo(resultSizeVector); |
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
typedef struct __attribute__((packed)) Tableau { | |
int rows, columns; | |
float matrix[MAX_ROWS * MAX_COLS]; | |
bool dual_program; | |
} Tableau_t; | |
Tableau_t *tableau; |
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
ScriptC_simplex script = new ScriptC_simplex(renderScript); | |
ScriptField_Tableau tableau = new ScriptField_Tableau(renderScript, 1); | |
int rowCount = data.length; | |
int columnCount = data[0].length; | |
tableau.set_rows(0, rowCount, false); | |
tableau.set_columns(0, columnCount, false); | |
tableau.set_dual_program(0, minimize, false); | |
tableau.set_matrix(0, data, false); | |
// Copy all values at once to the allocated memory of the struct. | |
tableau.copyAll(); |